Lexer and parser generators using CTFE

Jacob Carlborg doob at me.com
Thu Mar 1 12:32:50 PST 2012


On 2012-03-01 18:21, Philippe Sigaud wrote:
>  > > But how to associate actions with a rule, in that case? I mean, some
>  > > rules will have actions, some not.
>  >
>  > You could maybe just put D code in the grammar string, which gets
>  > compiled as a string mixin by CTFE?
>
> I could, but one of my driving goals while beginning this project a
> month ao was to use the shiny new lambda syntax directly :)
>
> "rule1", o => o
> "rule2", o => o
>
> etc.
>

Maybe we can take some ideas from the CoffeeScript compiler (written in 
CoffeeScript) :

Grammar: 
http://jashkenas.github.com/coffee-script/documentation/docs/grammar.html

Lexer: 
http://jashkenas.github.com/coffee-script/documentation/docs/lexer.html

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list