[antlr-interest] Advice sought on constructing "tree of token lists"

mzukowski at yci.com mzukowski at yci.com
Fri Feb 21 08:41:41 PST 2003


Did you figure this out or do you still need advice?  Have you seen my
filter example, where I use a parser to filter tokens to be fed to another
parser?  www.codetransform.com/filterexample.html

Monty

-----Original Message-----
From: micheal_jor <open.zone at virgin.net> [mailto:open.zone at virgin.net]
Sent: Thursday, February 06, 2003 7:34 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Advice sought on constructing "tree of token
lists"


I am attempting to use an ANTLR parser to build an AST in which all 
the nodes are essentially anchors for imposing some structure on the 
input list of Tokens.

The parser is itself a TokenStream and is being used for pre-
validation and pre-simplification of the input stream. All the input 
tokens can potentially pass through or a few may be dropped or 
altered.

I am seeking advice on how to persuade an ANTLR parser to allow 
access to all the original tokens as matched in each rule. I am 
proceeding on the assumption that buildAST must be false and that I 
have to do all the treebuilding manually since ANTLR parsers would 
normally "convert" input tokens into corresponding AST objects.

To clarify:

1. An AST node in the tree is a mechanism for storing a list of 
tokens matched by a rule. The tokens corresponds to the grammar rule 
that constructed the node.

2. An AST node may have one or more such lists of tokens - the list 
of tokens may be partitioned (using action code) depending on the 
rule.

Cheers,

Micheal



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list