|Pliant talk forum
Discussion: syntax for simple metas
Discussion to build tools for "simple" meta writting
|Message posted by pom on 2002/05/10 07:45:09
|I propose the following constructions to specify the syntax of a "simple"
1/ as for a type, different successive parts of a syntax are given sequentially,
with the keyword indicated first
2/ to specify non exclusive optional indications, use "optional" with
different option syntax indented
3/ to specify exclusive optional indication, use "exclusive" with a selector
and different option syntax indented
4/ to specify a sequence of 0 or more things, use "sequence"
5/ simple arguments are declared with "arg"
- "constant" may be used to declare a constant argument
- the type should be provided, or "any" should be typed instead with
an optional argument to receive the actual type (argument is compiled)
or expression (to avoid compilation)
arg Int first_arg
arg Str key_arg # no default value, should test existence before use
arg Int toto <- 2
exclusive switch_key2 optional # default is first
arg Int val1 <- 0
arg Int val2 <- 1
sequence arg Float values
arg expression bloc
|Message posted by pom on 2002/05/10 07:50:54
|In the previous example, the syntax is:
'mymeta' followed by an Int value, then any of the following options:
keyword 'key' followed by a Str
keyword 'key2' followed by an Int and, optionaly, by one of the following:
keyword 'subkey1' followed by 2 Ints
(which is the default, with values 0 and 1)
keyword 'subkey2' followed by some Float values
(stop when arg may not be casted to Float anymore or end of expression is reached, or ??)
last, an expression
|Message posted by maybe Hubert Tonneau on 2002/05/10 11:09:07
|I'd prefer something like:
function myfunction i (o1 u) (o2 a b)
arg Int i ; arg Int u <- 2 ; arg Str a b
If used within the function 'o1' and 'o2' are a boolean value specifying if the
optional arguments have been provided.
Sample usage of this function could be:
myfunction 2 o1 5
myfunction 2 o2 "" "abc"
myfunction 2 o1 3 o2 "" "abc"
myfunction 2 o2 "" "abc" o1 3
|Message posted by maybe pom on 2002/05/10 17:20:46
|I don't know if this syntax is general enough.
The aim of some extended syntax (even if there are some shortcuts
to write simple syntax as you say) is to make it possible to document
a broad range of meta in a common way, and even to specify some general
|Message posted by maybe pom on 2002/05/10 17:22:11
|Actually, the aim is to create some general prototype and some "recursive"
parsing function for expressions.