www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Enhanced LALR(1) Parser Generator for D

reply Peter Williams <pwil3058 bigpond.net.au> writes:
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

As an exercise to help me learn D, I've implemented an enhanced version 
of the LALR(1) parser generator described in Aho, Sethi and Ullman's 
dragon book.  The enhancements include:

1. a built in lexical analyser (where a flex like pattern is required as 
part of the definition of a token),

2. the ability to resolve reduce/reduce conflicts using predicates 
attached to grammar rules (inspired by the work of Ganapathi and Fischer 
in the 80s), and

3. for "literal" tokens the option of using the literal pattern in 
grammar rules instead of the token name e.g. if you had a token named 
LESSOREQUAL with the pattern "<=" then you can "<=" in grammar rules 
instead of LESSOREQUAL.

The code for this tool resides in the dunnart repository at GitHub.

Unfortunately, at this stage, the documentation is not very good but a 
small example that illustrates all features is attached.

As I said at the start, this was an exercise in learning D so there may 
be room for improvement in some of the code.  Suggestions are welcome.

Cheers
Peter
Apr 09 2013
next sibling parent "angel" <andrey.gelman gmail.com> writes:
I don't see no 'dunnart' on GitHub.
Could you please post a plain link ?
Apr 10 2013
prev sibling parent "simendsjo" <simendsjo gmail.com> writes:
On Wednesday, 10 April 2013 at 08:41:53 UTC, angel wrote:
 I don't see no 'dunnart' on GitHub.
 Could you please post a plain link ?

https://github.com/pwil3058/dunnart
Apr 10 2013