Re: Syntax comments

Pedro Szekely ([email protected])
Mon, 09 Jan 1995 11:14:17 PST

JK,

I think that the syntax you proposed is very similar to the one I proposed.
As I see it, the main difference is that the object types appear before the
curly brackets, rather than as the first symbol after the curly brackets.

However, this creates a problem. In the following example, is "Guides" a
multi-valued attribute of My_Template, or is it a declaration of an object of
type "Guides". The syntax is more context sensitive, because the first word
after a { is sometimes a keyword (attribute) and sometimes a type. For this
reason I like the prefix notation better.

Template My_Template {

Guides {
Guide g1 {
direction equals VERTICAL,
position equals 50,
margin_1 equals 4,
margin_2 equals 3,
}

The other differences are minor:

- use of "equals" rather than nothing to indicate the fillers of the keywords.
I would suggest using the = sign if we want to have a syntactic marker.

- use a comma to indicate end of values for a keyword. I would use a
semi-colon. Commas give the impression of a list of things.

- no special marker for object reference. In JK's example, the reference to
guide g1 is just g1 rather than @g1. I wonder if the lack of marker makes it
the syntax ambiguous. If the parser sees a g1, is it a symbol or a reference
to an object. Maybe the context is enough to dismabiguate. We need to look
at this more carefuly.

- I didn't understand why Guides, Grids and Parts were capitalized.

How about a syntax that looks like this. Keep the prefix notation for types,
to avoid the ambiguity mentioned above. Use = rather than equals, and use
comma to separate key/value pairs. Also, the name of the object is optional,
and if provided, appears as the first word after the type.

{Template My_Template,
guides {Guide g1,
direction = VERTICAL,
position = 50,
margin_1 = 4,
margin_2 = 3,
}
{Guide g2,
direction = VERTICAL,
position = 290,
margin_1 = 0,
margin_2 = 6,
},
grids {Grid,
direction = HORIZONTAL,
stretchable = FALSE,
distance = 50,
start = g1,
end = g2,
},
parts {Template,
}
{Template,
},
}

Actually, now that I look at it, the comma between key/value pairs looks a bit
funny when the values are embedded objects.

I thought that when JK was suggesting a specialized syntax he had in mind
something much more different from what he mentioned. Something like the
following would be more compact and faster to type, but harder to read and to
learn.

Template My_Template {
guides g1, V, 50, 4, 3;
g2, V, 290, 0, 6;
grids H, F, 50, g1, g2;
parts Template {
guides ...
grids ...};
Template { ...};

Comments? Noi, Spencer?

Pedro Szekely
USC/ISI, 4676 Admiralty Way, Marina del Rey, CA 90292
Phone: 310/822-1511, Fax: 310/823-6714
URL: http://www.isi.edu/isd/HUMANOID-HOME.html