Cannot seem to properly reference [message #1034594] |
Fri, 05 April 2013 16:28 |
Robert Brown III Messages: 36 Registered: July 2009 |
Member |
|
|
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 #1034610 is a reply to message #1034594] |
Fri, 05 April 2013 16:59 |
|
Hi,
looks like you have some missunderstandings regarding the syntax.
first you should assign things (if you call a rule)
'then' output=Output
then you should use cross refs only at places where you want to cross ref
Function:
name=ID'('[City]')';
is ok
[Function] not,
you should replace it with
function=Function
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05443 seconds