On Jun 19, 2011, at 8:12 AM, Mark Wright wrote:
>> [snip]

>> You can also look at the source code at:
>> 
>> http://antlr.org/depot/antlr4/main
>> http://antlr.org/depot/antlr4/main/tool/src/org/antlr/v4/codegen
>> 
>> Ter
> 
> Thanks, that's really neat.  The Java.stg is a lot smaller and simpler looking
> than before.

My goal this time was to make a really obvious templates and keep all of the 
logic were belongs in the model construction.

> I need to generate a trivial Java lexer, than try to hand code that
> into Haskell and/or Scheme, then try hacking the string templates some more.
> Scheme seems similar to Haskell for this, they are both weird and both
> use continuations :-).

:)

The cool thing about the new lexers is that everything is done at runtime. all 
I do is generate a serialized form of the augmented transition network / 
grammar and it creates the DFA (one per lex mode) on-the-fly as it needs to. 
So, all you need is really a reimplementation of LexerInterpreter in the 
runtime.

The generated parsers are literally simple LL(1) "switch on token type" 
decisions or "switch on interpreter.predict()"  so everything looks like it's 
simple LL(1), even though it fails over to the ATN for prediction when 
non-LL(1).


> I'm trying to learn Scheme for this purpose, with the idea of trying to
> write both Haskell and Scheme targets for v4.
> 
> Below is the same sketch of the Haskell dfa I sent earlier in Scheme.
> I'm not sure if v4 generates dfa's yet though, as it's commented in
> Java.stg:

we won't need DFA at all :)

Ter

_______________________________________________
antlr-dev mailing list
antlr-dev@antlr.org
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to