Use comma and dots instead of dot (easy flow).

This commit is contained in:
Stefano Sanfilippo 2014-11-23 22:32:41 +01:00
parent acce9c0c78
commit ae7920d5dd
2 changed files with 7 additions and 7 deletions

View File

@ -147,8 +147,8 @@ CHAR [a-zA-Z_]
"O scherziamo?" { "O scherziamo?" {
return CASE_END; return CASE_END;
} }
"." { "..." {
return DOT; return DOTS;
} }
[ \t\f\v] {} [ \t\f\v] {}

View File

@ -20,7 +20,7 @@ extern void emit(const char *, ...);
%token ASSERT_BEGIN ASSERT_END %token ASSERT_BEGIN ASSERT_END
%token LOOP_BEGIN LOOP_CONDITION %token LOOP_BEGIN LOOP_CONDITION
%token BRANCH_CONDITION BRANCH_BEGIN BRANCH_ELSE BRANCH_END CASE_END %token BRANCH_CONDITION BRANCH_BEGIN BRANCH_ELSE BRANCH_END CASE_END
%token COLON COMMA DOT %token COLON COMMA DOTS
%token FUNDECL PARAMS FUNCALL %token FUNDECL PARAMS FUNCALL
%token ABORT %token ABORT
%token ID NUMBER FLOAT %token ID NUMBER FLOAT
@ -49,19 +49,19 @@ fun_decls:
/* epsilon */ | fun_decls fun_decl /* epsilon */ | fun_decls fun_decl
; ;
fun_decl: fun_decl:
FUNDECL ID args DOT statements CASE_END FUNDECL ID args COMMA statements CASE_END
; ;
args: args:
/* epsilon */ | PARAMS arglist /* epsilon */ | PARAMS arglist
; ;
arglist: arglist:
ID | ID COMMA arglist ID | ID DOTS arglist
; ;
main: main:
MAIN statements MAIN statements
; ;
statements: statements:
/* epsilon */ | statements statement DOT | statements assert_stmt /* epsilon */ | statements statement COMMA | statements assert_stmt
; ;
statement: statement:
var_decl | assign_stmt | print_stmt | input_stmt | return_stmt | var_decl | assign_stmt | print_stmt | input_stmt | return_stmt |
@ -75,7 +75,7 @@ pointer:
/* epsilon */ | STAR /* epsilon */ | STAR
; ;
var_init: var_init:
/* epsilon */ | COMMA ASSIGN expression /* epsilon */ | ASSIGN expression
; ;
numeric: numeric:
NUMBER | FLOAT NUMBER | FLOAT