Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
byte32817yHow do you want to proceed, make an interpreter/compiler or just design the language?
Designing is simple enough, the interpreter can be a bit of work. -
Take a candy. You'll need it.
Ok
so start off by designing your language like what you want on paper.
Then, write a simple context free grammar for it. Then, write lexer/parser.
I would Suggest you to make it interpreted - making it compiled for such easy paradigms is a waste of time.
Interpreting something once you have a lexer/parser, It's a pretty easy job - especially if you know your lambdas.
Simply make the parser call the lambdas with the specific arguments.
Also; I would suggest you to only implement IO and keywords.
The rest should be done by standard library. -
@linuxer4fun Harder than I thought... Any tutorial suggestions? (even though i am pretty sure tuts are useless cuz all langs are different)
-
@codePatrol how does that answer the question?
@CozyPlanes unfortunately, there aren't many good, practical and free learning resources out there (at least I yet have to find them). What I did: roughly learn the individual phases of an interpreter/compiler (lexing, parsing, semantic validation and code generation) and then, with a bit of logical thinking, trying to figure out how they could possibly work.
Yes, that surely isn't the best way, but it works pretty well for me so far and I'm learning quite a lot -
@codePatrol You can use yacc :P
but i think he wants to do it for learning purposes -
@linuxer4fun I honestly find using such tools to be more complicated and confusing than writing a simple parser on your own, *especially* when it's for learning purposes
-
@Krokoklemme If he's only looking to do addition, multiplication etc then he can write a really simple interpreted language in c++ by using his own data types and overloading the + - / * operators which would save a shit ton of work. It's not everything he'd need to do but a really good start.
-
@linuxer4fun yacc is pretty cool. Seems like something interesting to read about or use.
Related Rants
I am creating a new language. Not like C# but a language specifically for plus,minus,multiply,division stuff
Any tuts related to this?
rant
language
tutorials