aboutsummaryrefslogtreecommitdiff
path: root/lib/tokens.mly
blob: 7f907a3ea6281c42feecf0c665a8634bf67e65fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
%token <string>LOCATION_START
%token LOCATION_END

%token PLUS
%token MINUS
%token INCR             DECR
%token STAR
%token DIV
%token MOD

%token AMPERSAND
%token COMA
%token EQUAL
%token COLUMN
%token L_BRACKET        R_BRACKET
%token L_PAREN          R_PAREN
%token LT               GT
%token EXCLAMATION
%token AND              OR

%token EOF
%token EOL

%token <string>IDENT
%token <string>LITERAL
%token <string>INTEGER

%token COMMENT

%token ACT
%token IF
%token ELSE
%token ELIF
%token END
%token LET
%token SET
%token OBJ
%token LOC
%token NO
%token <string>KEYWORD
%token <Qsp_syntax.T.function_>FUNCTION

(* 
(b) if the token was declared left-associative, then the conflict is resolved
in favor of reduction;

(c) if the token was declared right-associative, then the conflict is resolved
in favor of shifting.
 *)

(* Exclamation should have the lower priority because the comments shall never 
   take place of the statements
 *)
%right EXCLAMATION
%right NO
(* The priority for the variable should be lower than the equality priority
   if I want to allow declare new variables *)
%nonassoc p_variable
%left AND OR
%right EQUAL GT LT GTE LTE
%left PLUS MINUS
%left STAR DIV
%left MOD
%left FUNCTION
%left L_PAREN 
%right R_PAREN
%left COMA
%left KEYWORD

%%