I agree that
this should be changed to enhance usability, even-tough I
prefer case-sensitive programming languages ;)
I used to prefer case-sensitive programming languages, but I've
changed my
mind and now prefer case-insensitive. If you have two names that just
differ
by case, then this is something that is prone to have bugs. For
example,
consider the common newbie mistake of using "True" instead of "true"
in
Smalltalk.
I agree that one should not have identifiers differing only in case.
However, I think, case-insensitive languages lead to inconsistent code,
especially for newbies: I currently take a Astrophysics lecture where
we program in FORTRAN. Most of my colleges have never written a program
before and they have never learned writing good looking source:
DO ii = 1,5
if mod(Il, 2) = 0 Then
Write(*,*) Ii
END if
end do
Not really easy to find bugs like this, I think ;)
Might I ask
you a question about SmaCC? I've got a parser like this:
A : B C { 1 }
| D E { 2 }
Is it somehow possible to tell the parser in certain conditions in 1,
that even-tough that clause matched, it should continue trying to
match
with the next clause? I couldn't find an obvious solution for this.
I'm not sure I understand your question. Are you trying to match: "B
C", "D
E", or "B C D E"? If so, you could use:
A : BC
| BC DE
| DE ;
BC : B C {1};
DE : D E {2} ;
Or you could use:
A : B C {1}
| B C D E {1. 2}
| D E {2};
If this isn't what you want, perhaps you can give a real world
example...
Sorry, my example is bad, it was just a silly idea of mine how I could
resolve my problem. The real thing is the following:
I am trying to parse Smalltalk code inside a completely different
grammar, similar to what you did with the SmallWiki parser. My parser
stripped down to the problem is the following, the scanner is similar
to StScanner in the SmaCC examples:
Method : Selector Condition? Body { ... } ;
Selector : (<keyword> Pattern)+ { ... } ;
Pattern : <name> { ... } ;
Condition : "if:" "[" { parse smalltalk block } ;
Body : { parse smalltalk method body } ;
When giving input like
a: anA b: aB
if: [ ... ]
^self
I get
a: anA b: aB
if: [ Token not expected ->... ]
^self
even before my code { parse smalltalk block } is evaluated. Similar
when giving
a: anA b: aB
^self
I get
a: anA b: aB
Token not expected ->^self
before I even had a chance to start the RB parser in { parse smalltalk
method body }. I expect that I'm doing something completely wrong, but
can't find the problem. I also tried to go with the debugger through
the SmallWiki parser, but there it just works and I don't see any
significant difference.
Thanks a lot for your help,
Lukas
--
Lukas Renggli
http://renggli.freezope.org