1. Weird syntax errors?
- Posted by boater Nov 17, 2012
- 1035 views
I'm running Eu 4.0.4 on a Windows 7 machine, and have recently run into some most odd looking syntax error reports. Doubtless my fault, but I cannot see why.
Under ED, if I write and then run
sequence work = {} atom flags = 32768 object hed work = and_bits(14, flags)w hed = 1
including the extra character mis-typed at the end of the fourth line, the run fails with an error 'attempt to redefine hed'
Even more peculiar: if I comment out the object declaration, in a feeble attempt to remove the source of the re-declaration
... --object hed ...
then the error is quite different - I end up with TWO 'Errors resolving the following references', both complaining about 'w', but one of them on line 5 (the mis-typed character), and one of them on line 7 - where the parser seems to be hallucinating the term again.
Anyone tell me what I am doing wrong (other than bad typing?)
2. Re: Weird syntax errors?
- Posted by DerekParnell (admin) Nov 17, 2012
- 1029 views
I'm running Eu 4.0.4 on a Windows 7 machine, and have recently run into some most odd looking syntax error reports. Doubtless my fault, but I cannot see why.
Anyone tell me what I am doing wrong (other than bad typing?)
The parser thinks that you are trying to define a variable called 'hed' that is a user-defined-type called 'w'.
To the parser, your code looks like ...
sequence work = {} atom flags = 32768 object hed work = and_bits(14, flags) w hed = 1
Which means that it thinks you are declaring a variable because the statement begins with a word that is not a keyword, and so could be a user defined type.
3. Re: Weird syntax errors?
- Posted by boater Nov 17, 2012
- 1016 views
Well that all seems very sensible, now you explain it.
But I still don't see why (if I remove the original definition of 'hed') the parser ends up believing that 'w' occurs on TWO lines??
4. Re: Weird syntax errors?
- Posted by mattlewis (admin) Nov 17, 2012
- 1000 views
Well that all seems very sensible, now you explain it.
But I still don't see why (if I remove the original definition of 'hed') the parser ends up believing that 'w' occurs on TWO lines??
That looks like a parser quirk...or maybe a bug. Keeping track of the line to point out can be difficult for stuff like this. I suspect that it first sees w on 23, and then it's actually used (as a user defined type name) on 25 in the apparent declaration of hed.
Matt