[antlr-interest] rules for complicated strings
Sharon Li
hushlee83 at yahoo.com.sg
Mon Jan 27 16:39:05 PST 2003
Hi,
How do I store a value read in from file, and reference the value later in the program?
my codes are as follow:
declaration
: (HEX "define" (v:VARIABLE) (d:NUMERIC))
{ System.out.println("#define "+v.getText()+" "+d.getText()); } ;
The result of the parsing may look like this: #define DURATION 100
I need to store the v:VARIABLE (i.e. DURATION) read in from the input and its value (i.e. 100), as the variable will be referenced later in other parts of the code.
Next, is there a good way I can specify a rule to represent complicated strings like this:
P(age) --> {.g(1)[-(90)g(1).][g(MAX_P_LEN*func(2,age/DURATION)).][+(90)g(1).]}
where parenthesis and brackets occur randomly and on both sides of the equation?
Somebody pls help. Thanks alot.
Yahoo! Travel
- Get the latest travel deals in town!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030128/197f6052/attachment.html
More information about the antlr-interest
mailing list