Nested vectors are implemented, including parser and class nstio.
[Faustine.git] / interpreter / nstparser.mly
1 %{
2 open Types
3 %}
4
5 %token <string> CONST
6 %token LPAR RPAR EOF POINT COMMA
7 %right COMMA
8 %left POINT
9 %start main
10 %type <Types.nest> main
11 %%
12 main: nest EOF { $1 };
13
14 scalar: CONST { Scalar(float_of_string $1) }
15 | CONST POINT { Scalar(float_of_string $1) }
16 | CONST POINT CONST { Scalar(float_of_string ($1 ^ "." ^ $3)) };
17
18 vector: LPAR nestpar RPAR { Vector($2) };
19
20 nestpar: nest { Unary($1) }
21 | nest COMMA nestpar { Binary($1,$3) };
22
23 nest: scalar { $1 }
24 | vector { $1 };