[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Anyone into writing interpreters I wrote a very simple interpreter
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 43
Thread images: 1
File: Animation.gif (287 KB, 1093x705) Image search: [Google]
Animation.gif
287 KB, 1093x705
Anyone into writing interpreters I wrote a very simple interpreter in a day here is a program to calculate prime numbers in my language:

var limit
input limit

var i
var x
var j
set i,1

label main
inc i
set j,1
jmpl isPrime,i,limit
jmp exit

label isPrime
inc j
jmpe foundPrime,j,i
jmpe foundPrime,j,9
set x,i
mod x,j
jmpe main,x,0
jmp isPrime

label foundPrime
print i
jmp main
label exit
>>
jmp b

var x
set x,10

label b
print x


I need to force the user to put all the variables he wants at the top of the program because this will crash the interpreter.
>>
>c++
>malloc
>strncmp

>windows """""""programmers""""""""
>>
>>53580592
Nice memes
C++ is a multi paradigm language.
But anyways I am probably a terrible programmer going to be a bum in a few months.
>>
>>53580620
It's fucking C++, just use
new Call();
>>
>>53580620
>>53580592
You suck at programming lmao. Also it's easy to make an interpreter that's what you learn in your first day in CS you fucking nigger.
>>
>>53580654
I only use the C compiler because visual studio 2k8 doesn't support c99 and there is no problem with using a C++ compiler to write C.
>>
>>53580654
I don't use any C++ features at all I am writing in C.
>>
>>53580680
Why would you use fucking VS2008?
Why would you use VS?
>>
>>53580694
>>53580680
Holy fuck you know nothing about programming I bet your fucking black your so fucking stupid I bet you couldn't write a HTTP request like me not this babies first CS assignment crap.
>>
>>53580697
Because VS is superior to any IDE in my personal opinion.
>>
No seriously, using char* and manual memory management in c++ is not a matter of bad taste. You're just plain bad.

>b-b-but it's just C
Why are you casting malloc then, faggot?
>>
>>53580708
I'm casting malloc because I'm using a C++ compiler I do not have anything else installed on my machine.
>>
Kill yourself op you made me want to vomit you fucking faggot.
>>
If you really want to use VS to write C code, you have to get VS2015. It's the first version of VS ever to support anything in the C language that's less than 20 years old. Otherwise, use a different language or a different IDE.
>>
Visual Studio 2008

2008


Fucking why
>>
>>53580746
I saved up a long time to buy 2008 and I'm probably going to be homeless in a few months so I'm afraid I can't afford it.
>>
Holy fuck who uses fucking 2008 are you fucking mentally retarded you can't program you retarded child.
>>
Are you stupid why are you using C I can write this language that you stole btw it's ASM in fucking python with split. Lol your fucking stupid OP.
>>
>>53580764
10/10 b8
>>
So much salt.
Good job anon, keep practicing!
>>
tfw wanted to talk about interpreters because I'm interested in them even if I suck but just get people mad at my programming style and tools who call me a retard I guess I'll go back to r9k you fucking normies.
>>
>>53580822
I was also proud at writing an interpreter even if it is very simple but I guess it's the easiest task for a real programmer so now I feel even shittier about myself fuck you guys btw I can't fucking run VS2015 on my 1gb ram rig you fucking normies.
>>
Incredible. The comments in this thread read almost like a parody of some arrogant, ignorant, neckbeard:

"OH WOW USING VISUAL BASIC 20008" "HHUH PLEB. I BET HE DOESN'T EVEN KNOW ERLANG" "LOOK AT ME. NOT USING THE NEW() KEY WORD" "WOW WHAT A RETARD I BET YOU CAN'T EVEN PROGRAM"

This is honestly one of the things I hate about image boards. The loudest, stupidest, mother fuckers are the always the most vocal when in reality none of you have probably never written any useful software in your lives and you know it. Feel free to keep shit posting though. I found it amusing and will be screen capping this thread.
>>
>>53580848
Then use gcc or clang not ancient stuff
>>
>>53580848
>>53580822
LMAO what a spaz! You can't program you fucking pretentious child fuck off back to your autism hole.

BTW I'm enjoying working on my fucking i7 workstation fucking poorfag.
>>
>>53580878
>25 replies
>8 posters
Just saying
>>
>>53580880
I like VS2008 so what? I'm writing personal projects with it and it's what I feel most comfortable with. Why don't you go back to writing fizz buzz with gcc you asshole.
>>
I guess next time I come with a screenshot I need a riced out *nix distro with screenfetch open in the terminal to show how 1337 I am and I should be writing code in Emacs which I spent 1000 hours modding.
>>
>>53580706
IDEs are pretty useless. Use g++ to compile. It supports c++14.
Also use a programmable editor.

In descending order of autism
-emacs
-vim
-atom
>>
>>53580822
Nope, it's not you bro. I've only been in this thread for a few minutes and I saw instantly the kinds of faggots who were disagreeing with you. The basic truth is almost everyone else in this thread is permanently unemployable for the simple reason that nobody could tolerate working with them. They're the kinds of guys who butt into discussions between coworkers about languages by saying something like "well, actuhally Rust cahn sckale much bettah. You shud use Mongodb for web scale performance." These faggots don't know what they're talking about. It's all about flaunting their autistic obscurities, not realizing that in the real world we choose the tools that work and are battle tested, not the latest neckbeard crazes.

True story bruh
>>
>>53580960
lmao how butthurt can you be you fucking loser.
Your a crappy programmer like everyone who uses M$ you I bet you couldn't wrap your mind around the linux kernel you fucking manchild.
>>
>>53580966
I hasn't been programming since 3 days you fucking idiot I like using visual studio period like millions of other programmers.
>>
>>53580980
I just use visual studio because it's the best IDE I know and I want to program not worry about learning the new cool toy.
>>
>>53580654
you know new is literally a call to malloc right? read the source code
>>
>>53581006
Alright that's cool too but VS is a Microsoft enterprise, so you will be limited to Microsoft environments, technologies, and timetables. With other software, you have more supported languages and more up to date standards.
>>
>>53581053
Oh actually I can just compile my source code with GCC whenever I fucking want.
>>
37 replies no discussion about interpreters.
>>
>>53581109
>implying people care about interpreters
nobody cares about your retarded niche interest
>>
>>53581109
Yep, it's quite sad.

How is an interpreter built anyway? I was actually going to try build a domain specific language for a problem the other day but then I realized I didn't know the first thing about interpreters.

How would you abstract something as complex as source code into something that can be parsed? wut do
>>
>>53581142
Look up https://en.wikipedia.org/wiki/Parsing_expression_grammar
>>
haha op went to kill himself after feeling a lot of shame hahahaha
Thread replies: 43
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.