Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #762

Please comment on my first parser

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end
From Bart Vandewoestyne <bart.vandewoestyne@gmail.com>
Newsgroups comp.compilers
Subject Please comment on my first parser
Date Wed, 10 Oct 2012 06:28:33 -0700 (PDT)
Organization Compilers Central
Lines 28
Sender johnl@iecc.com
Approved comp.compilers@iecc.com
Message-ID <12-10-004@comp.compilers> (permalink)
NNTP-Posting-Host news.iecc.com
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Trace leila.iecc.com 1349899506 90864 64.57.183.58 (10 Oct 2012 20:05:06 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Wed, 10 Oct 2012 20:05:06 +0000 (UTC)
Keywords parse, question
Posted-Date 10 Oct 2012 16:05:06 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:762

Show key headers only | View raw


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

Back to comp.compilers | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Please comment on my first parser Bart Vandewoestyne <bart.vandewoestyne@gmail.com> - 2012-10-10 06:28 -0700
  Re: Please comment on my first parser Jim Patchell <patchell@cox.net> - 2012-10-13 20:50 -0700

csiph-web