[antlr-interest] Re: rules for complicated strings

micheal_jor <open.zone at virgin.net> open.zone at virgin.net
Tue Jan 28 01:56:57 PST 2003


> 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?

What does the above mean?. 

To answer your question, yes you can formulate rules for any 
structured input.  You already have "rules" for composing such 
expressions by hand (else you won't be able to determine their 
validity), you can specify those rules in ANTLR notation (I believe 
another poster has already supplied a starting point).

As for the above, I ask what it is/means because it seems to a layman 
like myself - who has no idea what it is for - that the expression 
syntax could be greatly simplified without loss of fidelity. In 
designing a parser one should strive for simplicity/clarity of 
expression - the language might survive for years.

Micheal



 

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



More information about the antlr-interest mailing list