[antlr-interest] your Or ast question
Randall R Schulz
rschulz at sonic.net
Thu Oct 2 18:34:11 PDT 2008
On Thursday 02 October 2008 17:54, you wrote:
> Mr. Schulz :-
I'm sorry. My father isn't here right now...
> Sorry for this disconnected reply to your last message to me.
It's OK. I hope you don't mind my sending the reply back to the list.
I'm surprised this seems so difficult (not yet conceding
impossibility!), so I think it would be generally interesting to have
the whole list membership observe the attempts.
> ...
>
> recapping from memory, you want
>
> p | q | r | s
>
> to be represented, essentially, as an ast of
>
> (| p q r s)
Precisely.
> ...
>
> maybe try this
>
> o : (a->a) ( ('|' a)+ -> ^('|' a+) )? ;
The result is the same:
(Or p (Or q (Or r (Or s))))
> and also sorry, because i have forgotten your op7xxFormula rule
> naming.
Well, it's idiosyncratic, to be sure, but I just chose it based on the
language description I was using to write the grammar. There is nothing
even approximating a BNF for this language, so there's a lot of
interpretive leeway. That would be fine, but the software I'm trying to
emulate has a long history and thus I have to replicate it's grammar
pretty closely, lest I fail to successfully and properly transliterate
it.
> too many Sorries; but hope this helps...
Really, there's not need to apologize.
> -jbb
Thanks!
Randall Schulz
More information about the antlr-interest
mailing list