[antlr-interest] how hard would this be?
    Benjamin Shropshire 
    shro8822 at vandals.uidaho.edu
       
    Fri Feb 29 12:41:07 PST 2008
    
    
  
How hard would it be to build a parser that does most of the parsing in 
the tree parser stage. As an example, doing this with C might look like this
file : (a=tk | a=block)* -> (FILE a*);
tk :   !( '{'!  |  '}'! ) // not braces
block  :   '{' (a=block | a=tk)* '}')  ->(BLOCK a*) // matching braces
(I probably has syntax errors but you should be able to get the point)
Then a series of parsers would start rewriting the tree into more 
detailed structures. The idea comes from having some fairly heavy duty 
semantic dependencies in the syntax, possibly even out of order 
dependencies. The the above might make it possible to have each pass 
patch up what it known how to and generate the info needed for the next 
pass to do more.
Benjamin Shropshire
    
    
More information about the antlr-interest
mailing list