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

Re: Naming question



On Tue, Jun 18, 2002 at 02:24:00PM -0400, Phil Varner wrote:
> I was wondering what the justification was behind only allowing lowercase
> production names.  It seems that with SableCC being fully behind an OO
> paradigm both in using Java and in the design of the system, one would
> also want to be able use the same syntactic conventions (e.g.
> aProductionName = {a} aSubProductionName | {b} anotherSubProductionName)
> that they use when writing OO code.

SableCC aims at being "target language independent".  Yes, currently,
the only target language is Java, but this might change in the future.

Uppercase characters are reserved in SableCC for keywords.  This
allows to easily add new keywords (and features) to SableCC without
breaking backward compatibility.  It also provides for an easier path
to develop back-ends for case insensitive languages.

As for the use of uppercase and lowercase, you can notice that within
the generated Java source code, there are different mappings for that
same identifiers, depending on whether the identifier is used as a
class name (e.g. ASubProduction) or a field (aSubProduction) in full
respect of the Java conventions.  So, allowing Uppercase characters
would cause annoying problems.

Is it that hard to use a "_" within an identifier?  To me, at least,
it seems to be visually easier to clearly identify identifiers parts
using it. e.g.:

two_ions / twolions  vs twoIons / twolions

Etienne
-- 
Etienne M. Gagnon                    http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/