[antlr-interest] I got the parseing, now how do I do something useful ?

uiorean <uiorean at cluj.astral.ro> uiorean at cluj.astral.ro
Thu Feb 27 10:16:10 PST 2003


I wrote a lexer and a parser. Now my problem is how do I get the
parsed tokens stored (for further processing) ? 
My parser looks like:

entry:	(
		(insrd dest COMA source)
		|(insdest dest)	
		)*;

where I have

protected insrd:	 ADD_ 
		|ADC_
		|SUB_ 
                ;
protected source:	 REG
			|DOP
			|PORT
			|LDB
			|DST
			;
protected dest:		REG;

and so on...

i would like to do something like: 


entry:	(
		(i:insrd d:dest COMA s:source 
{somefunction(i.getText(), i.getType(), d.getText(), d.getType());})
		|(i1:insdest d1:dest
{somefunction(i.getText(), i1.getType(), d1.getText(), d1.getType());})	
		)*;

but this does not work.  I don't think I really need to build a tree
for this, there must be an easyer way.

I am new to this mather so any suggestion is appreciated.

L. Uiorean


 

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



More information about the antlr-interest mailing list