ERROR: Encountered "VAR" at line 1, column 1.

This forum is for any questions about the language Tutorial D or the Rel implementation of it.
Post Reply
davidb14
Posts: 1
Joined: Mon Sep 15, 2014 11:33 am

ERROR: Encountered "VAR" at line 1, column 1.

Post by davidb14 »

Just getting started.

Problem 1: Rel does not play nice on Windows 8. The default installation folder is C:\Program Files (x86) and that really doesn't make a good data location. Multiple strange error messages. I really would have to suggest that you don't use that as the default installation folder unless you're prepared to put the data somewhere else, like C:\ProgramData.

Uninstall doesn't work either. So I deleted everything I could find and reinstalled to a different folder and now it all works just fine. Until...

Problem 2:
Input: VAR myRelVar REAL RELATION {TUPLE {x 1, y "fish"}, TUPLE {x 2, y "zap"}}
Output: ERROR: Encountered "VAR" at line 1, column 1.

What am I missing?
Dave
Site Admin
Posts: 372
Joined: Sun Nov 27, 2005 7:19 pm

Re: ERROR: Encountered "VAR" at line 1, column 1.

Post by Dave »

Regarding Problem 1, that's a known problem with Windows and the off-the-shelf installer. I'm working on a work-around. I'm not sure what happened with uninstall -- I've tested it and used it on a number of occasions, and haven't had a problem. Are you using Windows 8 or Windows 8.1?

Regarding Problem 2, your syntax is incorrect. It's missing the semi-colon at the end of the statement, it's missing the KEY specification, and you're trying to create a variable by specifying a specific relation rather than a relation heading or (alternatively) specifying it via INIT.

It should be something like this:

Code: Select all

VAR myRelVar REAL INIT(RELATION {TUPLE {x 1, y "fish"}, TUPLE {x 2, y "zap"}}) KEY {x};
Or it could be something like this:

Code: Select all

VAR myRelVar REAL RELATION {x INTEGER, y CHAR} KEY {x};
myRelVar := RELATION {
    TUPLE {x 1, y "fish"}, 
    TUPLE {x 2, y "zap"}
};
Or this:

Code: Select all

VAR myRelVar REAL RELATION {x INTEGER, y CHAR} INIT(RELATION {TUPLE {x 1, y "fish"}, TUPLE {x 2, y "zap"}}) KEY {x};
Post Reply