[antlr-interest] Matching AST tokens by their text?

Joseph Gentle josephg at cse.unsw.edu.au
Tue Oct 9 07:31:33 PDT 2007


I have a grammar which looks very LISP-y:

(define (domain gripper-strips)
  (:predicates
   (room ?r)
   (ball ?b)
   (gripper ...

I've written an extremely simple tokeniser and parser to convert it  
into a tree which looks just the same, but in tokens its:

^(NAME ^(NAME ARGUMENT)
   ^(MACRO_NAME
     ^(NAME ARGUMENT)
     ^(NAME ARGUMENT)
     ^(NAME ...

Now I want to parse it, using rules like:

domain_definition: ^('define' domain_bits)
domain_bits
   : ^(':predicates' ...)
   | ^(':actions' ...)
   | ... etc


Is this possible? What's the best way to do this?

-J

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071010/b0c52046/attachment.html 


More information about the antlr-interest mailing list