Way cool!  Just curious...is the modal state variable automatically accessible 
to the parser?  Perhaps on a subchannel synced with the token stream?  Sorry to 
be tuning in late...always interested in new paths to semiosis.  :)   
Anyway...I need to take a look at girhub and think up a fun use.

Kyle

Sent from my Verizon Wireless BlackBerry

-----Original Message-----
From: Terence Parr <pa...@cs.usfca.edu>
Date: Wed, 26 May 2010 16:18:28 
To: antlr-interest@antlr.org interest<antlr-interest@antlr.org>
Subject: [antlr-interest] ANTLR v4 progress

Just passing along an example HTML subset lexer/parser using ANTLR v4; thanks 
to  debugging and moral support from Oliver Zeigermann, we got the code 
generation and runtime support working sufficiently to use the following 
grammars.   generate some really nice code indeed. You will note that, except 
for the enhancement of the lexer modes, the grammars are backward compatible 
with v3 :)

I still have a long way to go, but it's looking more & more useful (only does 
LL(1) code generation at this point).

Ter
---------------------------
lexer grammar HTMLLexer;

TAG_START : '<' {pushMode(INSIDE);} ;

COMMENT : '<!--' .* '-->' {skip();} ;

TEXT : ~'<'+ ;

mode INSIDE;

TAG_STOP : '>' {popMode();} ;

END_TAG : '/' ID '>' {popMode();} ;

ID : ('A'..'Z'|'a'..'z'|'0'..'9'|'_'|'#')+ ;

EQ : '=' ;

STRING : '"' .* '"'
       ;

WS : ' '+ {skip();} ;

------------------------

parser grammar HTMLParser;

options { tokenVocab=HTMLLexer; }

file : ( TAG_START (starttag | endtag) | TEXT)+ EOF ;

starttag : ID attr* TAG_STOP ;

attr : ID (EQ (ID|STRING))? ;

endtag
        :        END_TAG
        ;


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to