[antlr-interest] interactive envionments and non-delayed rule reduction

Neurosurg khamenya at mail.ru
Mon Aug 2 05:18:32 PDT 2004


Hi all,

in interactive environments, the input expression should be 
parsed and evaluated right after, say, the enter is pressed.
Parser is not expected to wait for the further following input.
This is not what we get if we consider in the pasted below
grammar taken after calc.g from antlr examples.
After the first expression is provided, semicolon is given
and even end-of-line (EOL) is entered -- still no reduction 
according to expr rule is done. The output is given only 
after some next expression is given.

----------------------------------
top
	: (expr)*
	;

expr	:	mexpr (PLUS^ mexpr)* SEMI! EOL {
			CalcTreeWalker walker;
			float r = walker.expr(#expr);
			std::cout << "value is " << r << std::endl;
	}
	;

mexpr	:	atom (STAR^ atom)* ;

atom:	INT ;
----------------------------------

any good hints/links? 
(RTFMed, STFWed, sorry if missed smth)
thanks,
Valery




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list