Writing a language parser in D

Ellery Newcomer ellery-newcomer at utulsa.edu
Mon Sep 14 15:31:12 PDT 2009


Justin Johansson wrote:
> Can D people please recommend suitable tools for generating a parser (in D) for an LL(1) grammar.  There's bound to be much better parser generator tools available nowadays, since my last foray into this area 10+ years ago with YACC.  I've heard of tools like bison, SableCC etc but apart from the names know nothing about them.
> 
> (Note.  This question is not about writing a parser for D.  It is about writing a parser in D for another language which has an LL(1) grammar).
> 
> Thanks in advance for all help.
> 
> -- Justin Johansson
> 


You might have a look at ANTLR. It's an LL(k) or LL(*) (versions) parser
generator. I've found it suitable for writing a parser for D (yes I
know), so it is definitely powerful enough.

Currently, there is no implementation of ANTLR that generates D code, so
if you really want a pure D parser, look elsewhere. However, I believe
it can generate C, which you might be able to link to. If so, I'd say
it's your best bet.



More information about the Digitalmars-d mailing list