diff options
Diffstat (limited to 'src/tpc.y')
-rw-r--r-- | src/tpc.y | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -55,32 +55,32 @@ static char fname[64]; | |||
55 | %precedence ELSE | 55 | %precedence ELSE |
56 | 56 | ||
57 | %% | 57 | %% |
58 | Prog: { gen_prologue(); } | 58 | Prog: { gen_prologue(); } |
59 | DeclConsts DeclVars DeclFoncts { gen_const_declaration(); } | 59 | DeclConsts DeclVars DeclFoncts { gen_const_declaration(); } |
60 | ; | 60 | ; |
61 | DeclConsts: | 61 | DeclConsts: |
62 | DeclConsts CONST ListConst ';' | 62 | DeclConsts CONST ListConst ';' |
63 | | | 63 | | |
64 | ; | 64 | ; |
65 | ListConst: | 65 | ListConst: |
66 | ListConst ',' IDENT '=' Litteral | 66 | ListConst ',' IDENT '=' Litteral { gen_const($<ident>1, $<num>3, scope); } |
67 | | IDENT '=' Litteral | 67 | | IDENT '=' Litteral { gen_const($<ident>1, $<num>3, scope); } |
68 | ; | 68 | ; |
69 | Litteral: | 69 | Litteral: |
70 | NombreSigne | 70 | NombreSigne { $<num>$ = $<num>1; } |
71 | | CARACTERE | 71 | | CARACTERE { $<num>$ = $<num>1; } |
72 | ; | 72 | ; |
73 | NombreSigne: | 73 | NombreSigne: |
74 | NUM | 74 | NUM { $<num>$ = $<num>1; } |
75 | | ADDSUB NUM | 75 | | ADDSUB NUM { $<num>$ = $<addsub>1 == '-' ? - $<num>2 : $<num>2; } |
76 | ; | 76 | ; |
77 | DeclVars: | 77 | DeclVars: |
78 | DeclVars TYPE Declarateurs ';' | 78 | DeclVars TYPE Declarateurs ';' |
79 | | | 79 | | |
80 | ; | 80 | ; |
81 | Declarateurs: | 81 | Declarateurs: |
82 | Declarateurs ',' Declarateur { gen_declaration($<ident>3, $<type>0, scope); } | 82 | Declarateurs ',' Declarateur { gen_declaration($<ident>3, $<type>0, scope); } |
83 | | Declarateur { gen_declaration($<ident>1, $<type>0, scope); } | 83 | | Declarateur { gen_declaration($<ident>1, $<type>0, scope); } |
84 | ; | 84 | ; |
85 | Declarateur: | 85 | Declarateur: |
86 | IDENT | 86 | IDENT |