[antlr-interest] speaking of => etc...

Olivier Dragon dragonoe at mcmaster.ca
Thu Dec 8 12:00:31 PST 2005


On Thu, Dec 08, 2005 at 11:15:47AM -0800, Terence Parr wrote:
> So, we have a syntax / notation problem for predicates now.  I am  
> proposing the following new notation:
> 
> [...]		optional subrule
> (...)?		syntactic predicate
> a : (alt)? | ... ;	syntactic predicate wrapping whole production
> {...}?		_hoisting_ disambiguating semantic predicate
> {...}=>	gated semantic predicate
> rule		rule reference
> <rule(args)>	rule reference with args
> ID		token reference
> <ID(args)>	token reference with options
> 
> The blog shows my reasoning:

As someone who is very much used to UNIX style regular expressions I
find this quite combersome, especially the new optional subrule syntax.
I think (...)? is quite intuitive as a "maybe". How about this:

(...)?             optional subrule
(...)#>            syntactic predicate
{...}>>            hoisting disambiguating semantic predicate
{...}=>            gated semantic predicate

That way we keep the optional subrule syntax, the synpred diffrentiates
itself from sempreds by the brackets, as well as shows it does not hoist
nor is evaluated if unnecessary with the different arrow, and hoisting
looks like it's going deep with >>.

And I like the consistency of having ">" mean some kind of predicate.

Just my 2 cents.

-Olivier

-- 
          __-/|    ? ?     |\-__
     __--/  /  \   (^^)   /  \  \--__
  _-/   /   /  /\ / ( )  /\  \   \   \-_
 /  /   /  /  /  (   ^^ ~  \  \  \   \  \
 / Oli Dragon    ( dragonoe at mcmaster.ca \
/  B.Eng. Sfwr   (     )    \    \  \    \
/  /  /    /__--_ (   ) __--__\    \  \  \
|  /  /  _/        \_ \_       \_  \  \  |
 \/  / _/            \_ \_       \_ \  \/
  \_/ /                -\_\        \ \_/
    \/                    )         \/
                        *~
        ___--<***************>--___
       [http://dragon.homelinux.org]
        ~~~--<***************>--~~~


More information about the antlr-interest mailing list