[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in SableCC 2.17.2?



Xuan Baldauf wrote:
> 
> Where can I find documentation about the grammar definition file
> format (except the thesis and the example grammars)?

This is probably not what you want, but the grammar itself is described
as a SableCC grammar in one of the examples.  The best reference (with
explanations) are chapters 5 & 6 in the thesis...  And there's always
this list to ask for clarifications;-)

> Are there any difference between a "set of alternatives of characters"
> and a "set of characters" in using them? (Does the former have
> advantages that the latter cannot have and vice versa?)

The advantage of using set of characters is the "-" operator that is not
available to "regular expressions".  This will eventually change in
SableCC 3.x.  The other advantage is the availability of "ranges" e.g.
['a'..'z'] which would be otherwise quite annoying to write 'a' | 'b' |
'c' | etc.

> With the current syntax, I have to write this (which is ugly):
> 
> separators  =
> [
>   [
>     [
>       [
>         [
>           '(' +
>...

This will also change in SableCC 3.x... (The difference between sets and
reg.exp. will disappear along the "+" operator.  You'll simply write:

xxx = (['a' .. 'z'] | ['A' .. 'Z'] | ['0' .. 10]) - ('3' | 'b' | 'F');

And even:

identifier = (['a' .. 'z'] (['a' .. 'z'] | ['0' .. '9'])*) - 'hello';

Neat, isn't it?  Yep, I'll have to do the dirty work to make this
happen:-)

But, this is not for tommorrow...  I'm just letting you (and myself)
dream a little:)

Have fun!
P.S. Big thanks to Mariusz for the quick modifications.  I like youe
"magic" debugging property a lot.
-- 
Etienne M. Gagnon                                    egagnon@j-meg.com
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/