Refactoring of class process in faustexp.ml.
[Faustine.git] / interpretor / parser.mly
1 %{
2 open Types
3 %}
4
5 %token <string> CONST
6 %token <Types.symbol> IDENT
7 %token LPAR RPAR SEQ SPLIT MERGE PAR REC EOF POINT
8 %right SPLIT MERGE
9 %right SEQ
10 %right PAR
11 %left REC
12 %left POINT
13 %start main
14 %type <Types.faust_exp> main
15 %%
16 main: faust_exp EOF { $1 };
17 faust_exp: CONST { Const(N (int_of_string $1)) }
18 | CONST POINT { Const(R (float_of_string $1)) }
19 | CONST POINT CONST { Const(R (float_of_string ($1 ^ "." ^ $3))) }
20 | IDENT { Ident($1) }
21 | LPAR faust_exp RPAR { $2 }
22 | faust_exp PAR faust_exp { Par($1,$3) }
23 | faust_exp SPLIT faust_exp { Split($1,$3) }
24 | faust_exp MERGE faust_exp { Merge($1,$3) }
25 | faust_exp SEQ faust_exp { Seq($1,$3) }
26 | faust_exp REC faust_exp { Rec($1,$3) };