summary refs log tree commit diff
path: root/source/mod_student/parser.mly
diff options
context:
space:
mode:
Diffstat (limited to 'source/mod_student/parser.mly')
-rw-r--r--source/mod_student/parser.mly27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/mod_student/parser.mly b/source/mod_student/parser.mly
index d2216a6..4889d11 100644
--- a/source/mod_student/parser.mly
+++ b/source/mod_student/parser.mly
@@ -34,6 +34,26 @@ let mkTag =
 %token RPAREN
 %token LBRACKET
 %token RBRACKET
+%token COLON
+%token OP_PLUS
+%token OP_MINUS
+%token OP_MULT
+%token OP_DIV
+%token OP_REM
+%token OP_AND
+%token OP_OR
+%token OP_EQ
+%token OP_NEQ
+%token OP_LE
+%token OP_GE
+%token OP_LT
+%token OP_GT
+%token ASSIGN
+%token IF
+%token ELSE
+%token WHILE
+%token RETURN
+%token LENGTH
 %token <int>INT
 %token <string>IDENTIFIER
 %token <char>CHAR
@@ -51,10 +71,15 @@ let mkTag =
 
 (* Obecnie potrafimy sparsować tylko pusty plik (wymagamy od razu tokena EOF) *)
 file:
+    | declarations= list(func) EOF
+    { ModuleDefinition {global_declarations=declarations } }
     |  EOF
     { ModuleDefinition {global_declarations=[] } }
 
-
+func:
+    | id=identifier LPAREN RPAREN 
+    { GDECL_Function { loc=Location( {line=0;column=0;file=""});
+    id=id;formal_parameters=[]; return_types=[];body=None} }
 identifier:
     | IDENTIFIER
     { Identifier $1 }