Cannot seem to properly reference [message #1034594] |
Fri, 05 April 2013 12:28  |
Eclipse User |
|
|
|
Greetings:
I am attempting to do references in the language I am developing. The language I am developing has a syntax for representing latitudes and longitudes. This syntax is:
Boston: 42 N 21, 71 W 5
NewYork: 40 N 47, 73 W 58
Roanoke: 37 N 17, 79 W 57
What I would like to do is to be able to declare cities and later in my program refer back to them, like so:
if [Lat(Boston) is N] then write("Boston is in the Northern Hemisphere")
I have a set of rules that I am attempting to use to be able to construct such a syntax:
City:
Name=ID':' ladeg=INT LADir lamin=INT', 'lodeg=INT LODir lomin=INT
;
LODir: ('W' | 'E');
LADir: ('N' | 'S');
Function:
name=ID'('[City]')';
IfStat:
'if' '[' [Function] 'is' [LADir] 'then' Output
;
Output:
'write''('writing=STRING')'
;
I am getting all kinds of bizarre errors, some of them sayig that my "rules have to be unique" whenever I attempt to put in my references. I have read the section on references, and I do understand that the reference syntax '[]' refers to what is returned from the rule, but I am not actually changing what is supposed to be returned. Also: I do not see any reason why XTexy should say that my LADir and Output rules are not unique (My Output rule error goes away when M eliminate it in my IfStat rule!). I am slso getting errors with the [City] references.
I have read the section in the docuentation on References, and based on what little it actually says about them it looks like I am properly utilizing them.
I know something is not right here, I just don't know what that is. Could soeone please enlighten me???
|
|
|
|
|
|
|
|
|
Re: Cannot seem to properly reference [message #1038962 is a reply to message #1037538] |
Thu, 11 April 2013 10:56  |
Eclipse User |
|
|
|
Actually:
I did give you an accurate copy of the language, but as it turns out I forgot to make a change to the language file after generating the artifacts.
Apparently, when you make changes to the grammar and regenerate the artifacts, your changes aren't reflected in the resulting language editor until you make a change to the file.
I had probably gotten this right days ago, but kept seeing errors until I added a change after seeing your last post. The grammar works without problems.
Sorry for the annoyance...
|
|
|
Powered by
FUDForum. Page generated in 0.05250 seconds