Alright I have been looking into parsing and things I have found a lot of information. Mostly it appears that bottom-up parsing is harder than top-down parsing, but top-down is easier.
I was wondering what some of you people who have parsed languages before used/think what's best?
One thing I don't get about bottom-up parsing is doing it with tables. If someone could explain this to me then that would help a lot.
[C]Parsing
Moderator: MaxCoderz Staff
The tools you need to create parsers or compilers are Flex and Bison. But I've even taken a class about parsers, and still have no clue how to use them. I think that's where "Look at someone else's Flex and Bison code" comes into play.
You know your hexadecimal output routine is broken when it displays the character 'G'.
Usually you have a scanner that breaks the input up in tokens (which is what flex is used for) which are then passed on to the parser (which you can make with bison). The scanner will look for syntactic correctness and stuff, the parser will usually build an internal model of whatever you're parsing. When the model's complete, you can output it in another form (something you can pass on to an assembler, possibly ), give statistics about it, or whatever you were planning to do.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
Alright I have heard of everything you guys have suggested. Flex, Bison, YACC, and all that stuff. Those tools output crap as the syntax becomes harder and more complex which is why GCC devs switched to a hand written parser for C in 4.x and a hand written parser for C++ in 3.x and up.
I don't want to use Lexer or Parser generators. I have got a hold on top-down parsing and wrote my first one yesterday for a dummy language and top-down simplifies parsing a lot, but Bottom-up with a table can put top-down parsing to shame I thinking.
Although I guess I will just try a recursive top-down parser if I can't learn bottom-up :/
I don't want to use Lexer or Parser generators. I have got a hold on top-down parsing and wrote my first one yesterday for a dummy language and top-down simplifies parsing a lot, but Bottom-up with a table can put top-down parsing to shame I thinking.
Although I guess I will just try a recursive top-down parser if I can't learn bottom-up :/