Please comment on my first parser

Bart Vandewoestyne <bart.vandewoestyne@gmail.com>
Wed, 10 Oct 2012 06:28:33 -0700 (PDT)

          From comp.compilers

Related articles
Please comment on my first parser bart.vandewoestyne@gmail.com (Bart Vandewoestyne) (2012-10-10)
Re: Please comment on my first parser patchell@cox.net (Jim Patchell) (2012-10-13)
| List of all articles for this month |
From: Bart Vandewoestyne <bart.vandewoestyne@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 10 Oct 2012 06:28:33 -0700 (PDT)
Organization: Compilers Central
Keywords: parse, question
Posted-Date: 10 Oct 2012 16:05:06 EDT

Hello all,


Just as a hobby project, I am working my way through Appel's 'Modern Compiler
Implementation in C'. I have now finished Chapter 3 and it looks like my
parser for the Tiger language can parse all test examples from the book.


Nevertheless, I want to learn from this experience and improve my skills. It
would therefore be nice to get some more feedback from experts.
Comments/suggestions on my grammar rules, C-style, code-layout (indentation
etc),... are highly appreciated. Also, test-programs that reveal bugs in my
parser are welcome.


One thing I am not completely sure of is whether i solved the shift-reduce
problems correctly by adding some nonassoc lines for the DO, OF, THEN and ELSE
tokens... please let me know if this is the correct way to do it or not.




My grammar file and all other code for Chapter 3 can be found at:


https://github.com/BartVandewoestyne/c/blob/master/books/Modern_Compiler_Impl
ementation_in_C/chap03/tiger.grm


https://github.com/BartVandewoestyne/c/tree/master/books/Modern_Compiler_Impl
ementation_in_C/chap03


Thanks!
Bart



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.