[Aldor-l] Semicolon after single statement in if?
Pippijn van Steenhoven
pip88nl at gmail.com
Thu May 7 07:53:26 EDT 2009
On Thu, May 07, 2009 at 01:22:59AM +0200, Ralf Hemmecke wrote:
>> Removing the ; from either of the two last lines will be fine. The only
>> thing it does not accept is ;; anywhere.
>
> That ;; is not accepted is somewhat strange. If I look at the grammar,
> it says:
>
> Expression: enlist1a(Labeled, ";")
>
> So if ever you find a place in you program where "Expression" is
> appropriate, then also ;; should be appropriate.
I was wrong. The compiler actually does accept ;;, but not ;;;.
Try:
a := 3; -- works
a := 3;; -- works
a := 3;;;
.......^
(Error) Cannot recover from earlier syntax errors.
My (educated, since this happens all the time in the compiler) guess is
that the lexer has hacks to recover from ;; but it kills only one ;, so
the third ; is still read. All these hacks are getting me quite pissed..
Lexing a float, for instance:
float: integer '.' [ integer ]
| '.' integer
now notice the operator '.' and the operator '..' in:
2..3
this could be either of:
2. . 3
2. .3
2 . .3
2 .. 3
so there is code that takes care of this. I currently use a lookahead
character to decide this, so if I read a float "2.", I look whether the
next character is '.' and if so, push back the '.' into the stream and
return an integer. NAG-Aldor has some more code for this to decide
whether floats can exist in certain lexical contexts. Does the AUG have
anything on this?
--
Pippijn van Steenhoven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://aldor.org/pipermail/aldor-l_aldor.org/attachments/20090507/a8cf82c9/attachment.bin>
More information about the Aldor-l
mailing list