Made a grammer... what next?

closed account (Dy7SLyTq)
I made a grammer with the GPB. nothing to amazing. then i exported the file. what do i do next to make an interpreted language?
What's GPB? Anyway, once you've got a grammar figured out, you need to write a parser for it. You need to parse the program text into some sort of data structure. For instance, in LISP, that structure is just a pair of pointers (and all the lists and trees you can make out of that). For you it would involve a list of functions and a list of statements for each function and etc. Finally just write a function to execute that structure.
closed account (Dy7SLyTq)
thank you and its the GOLD parser builder
closed account (Dy7SLyTq)
so should i use something like bison then?
It seems that GPB is going to take care of the parser for you (with the Engine bit, whatever it outputs). Although I'm not sure why use anything at all. Parsing isn't that hard, especially if your grammar is simple enough for a recursive descent parser. The task is generally automated, because all parsers are pretty much the same (same methods, only different grammars), but the whole point of making toy projects is to learn, so you might as well do it yourself...
closed account (Dy7SLyTq)
one last question before i get started. am i limited to one language when making this or can i use whatever i need when i need it
I have no idea what you're asking about...
closed account (Dy7SLyTq)
am i limited to one language when making the parser, or can it be a hybrid, like compiled python and c++
I don't know if GPB forces you into something, but apart from that, a parser is no different from any other project - sure you can.
closed account (D4S8vCM9)
bison already creates the parser code for you, so if you think your grammar will grow more complex with time, I would move to it.
Else writing an object oriented recursive parser is not that much to do.
closed account (Dy7SLyTq)
hey i know this is an old thread, but is it allowed to have multiple start symbols?
@DTSCode, how in the world would that work? You probably just want to have S -> S1 | S2 | ...
closed account (Dy7SLyTq)
yes i know i realized that. i had actually copied the original grammar so now im writing my own. i now realize after reading a tutorial why that wouldnt work. im sorry for bothering you guys
closed account (Dy7SLyTq)
hey do you guys know on a good tutorial that teaches me how to build a recursive parser builder? i can only find source code
Here is a link to one of a series of videos that helped me:
Topic archived. No new replies allowed.