Previous Next

GRAIL Syntax

Use of Brackets

One of the confusing things about the existing GRAIL syntax is that it uses three different kinds of brackets for three different purposes.

You will see different types of parentheses used in the compiler;

()
Used to enclose a sub definition in long complicated definitions - ordinary brackets. An example not using GRAIL syntax might be:

(people who are tall) who have (hair which is grey).

In this expression

(people who are tall)

defines a kind of people and

(hair which is grey)

defines a kind of hair. Together the two sub-definitions are used to define tall people with grey hair, or if you prefer tall grey-haired people.

[]
Used for expandable lists. Expandable lists are a kind of short-hand; these lists are expanded by the compiler before being passed to the underlying system. This will be explained more fully below, but the pattern is that

tell [mary john karen].

means exactly the same as

tell mary.
tell john.
tell karen.

<>
Used to group criteria in definitions. Again, as another example not using proper GRAIL syntax,

People who <are tall have grey hair>

would be people who are tall and have grey hair or again tall grey-haired people. Note that the and is understood inside <...>.

Use of full stops

All GRAIL expressions must end with a full stop. If you don't have a full stop at the end of a statement, you may get various odd syntax errors which are not always helpful. If you can’t figure out what is wrong with the syntax or why the GRAIL compiler does not recognise something, look for a missing full stop.

Comments

GRAIL treats anything between double quotes "..." as a comment. By convention long comments are put in the form:

“>>>>>>>>>>>>>>>>>>>>>>
> This is a comment
> extending over two lines
<<<<<<<<<<<<<<<<<<<<<<”

Previous Next
Making the impossible very difficult, ©OpenGALEN.org, All rights reserved