HIGHER SUBLEQ

Compiler into OISC language

Last update March 2011

All tests

Legend
- implemented
- not implemented

NameDescriptionParse Compile Test
T.1token := keyword mt_1
T.2token := id triv
T.3token := const mt_3
T.4token := string mt_4
T.5token := punctuator mt_5
T.6token := comment mt_6
G.1program := list of functions or declarations (one funcion must be main) mg_1
G.2.1declaration := type_name comma list of declarators ; mg_2_1
G.2.2declaration := extern type_name comma list of ( id or id[] ) ; mg_2_2
G.3type_name := void, int, or char plus optional *'s mg_3
G.4.1declarator := id mg_4_1
G.4.2declarator := id = ass_expr mg_4_2
G.4.3declarator := id [ ass_expr ] mg_4_3
G.4.4declarator := id [ ] = string mg_4_4
G.4.5declarator := id [ ] = { expr_list } mg_4_5
G.5.1function := type_name id ( param_type_list ) block mg_5_1
G.5.2function := type_name id ( param_type_list ) ; mg_5_2
G.6param_type_list := empty or comma list of type_name idopt mg_6
G.7block := { list of statements } mg_7
G.8.1statement := ; mg_8_1
G.8.2statement := block mg_8_2
G.8.3statement := keyword_statement mg_8_3
G.8.4statement := labeled_statement mg_8_4
G.8.5statement := expression ; mg_8_5
G.8.6statement := declaration mg_8_6
G.9.1keyword_statement := for ( statement expressionopt ; expressionopt ) statement mg_9_1
G.9.2keyword_statement := while ( expression ) statement mg_9_2
G.9.3keyword_statement := if ( expression ) statement mg_9_3
G.9.4keyword_statement := if ( expression ) statement else statement mg_9_4
G.9.5keyword_statement := goto id ; (id may not be defined at this point) mg_9_5
G.9.6keyword_statement := goto expression ; mg_9_6
G.9.7keyword_statement := continue; mg_9_7
G.9.8keyword_statement := break; mg_9_8
G.9.9keyword_statement := return; mg_9_9
G.9.10keyword_statement := return expression; mg_9_10
G.10labeled_statement := new in current scopes id : statement mg_8_4
G.11.1expression := ass_expr mg_11_1
G.11.2expression := exression , ass_expr mg_11_2
G.12.1ass_expr := conditional_expr mg_12_1
G.12.2ass_expr := unary_expr ass_operator ass_expr mg_12_2
G.13ass_operator := one of   = -= += mg_13
G.14.1equality_expr := rel_expr mg_14_1
G.14.2equality_expr := equality_expr == rel_expr mg_14_2
G.14.3equality_expr := equality_expr != rel_expr mg_14_3
G.15.1rel_expr := add_expr mg_15_1
G.15.2rel_expr := rel_expr < add_expr mg_15_2
G.15.3rel_expr := rel_expr > add_expr mg_15_3
G.15.4rel_expr := rel_expr <= add_expr mg_15_4
G.15.5rel_expr := rel_expr >= add_expr mg_15_5
G.16.1add_expr := mul_expr mg_16_1
G.16.2add_expr := add_expr + mul_expr mg_16_2
G.16.3add_expr := add_expr - mul_expr mg_16_3
G.17.1mul_expr := unary_expr mg_17_1
G.17.2mul_expr := mul_expr * unary_expr mg_17_2
G.17.3mul_expr := mul_expr / unary_expr mg_17_3
G.17.4mul_expr := mul_expr % unary_expr mg_17_4
G.18.1unary_expr := postfix_expr mg_18_1
G.18.2unary_expr := ++ unary_expr mg_18_2
G.18.3unary_expr := -- unary_expr mg_18_3
G.18.4unary_expr := & unary_expr mg_18_4
G.18.5unary_expr := * unary_expr mg_18_5
G.18.6unary_expr := + unary_expr mg_18_6
G.18.7unary_expr := - unary_expr mg_18_7
G.18.8unary_expr := ! unary_expr mg_18_8
G.19.1postfix_expr := prim_expr mg_19_1
G.19.2postfix_expr := postfix_expr [ expression ] mg_19_2
G.19.3postfix_expr := postfix_expr ( expr_list ) mg_19_3
G.19.4postfix_expr := postfix_expr ++ mg_19_4
G.19.5postfix_expr := postfix_expr -- mg_19_5
G.20expr_list := empty or comma list of ass_expr mg_20
G.21.1prim_expr := known id mg_21_1
G.21.2prim_expr := const mg_21_2
G.21.3prim_expr := string mg_21_3
G.21.4prim_expr := ( expression ) mg_21_4
G.21.5prim_expr := operator_io mg_21_5
G.22.1operator_io := __out expression mg_22_1
G.22.2operator_io := __in mg_22_2
G.23.1conditional_expr := logic_or_expr mg_23_1
G.23.2conditional_expr := logic_or_expr ? expression : conditional_expr mg_23_2
G.24.1logic_or_expr := logic_and_expr mg_24_1
G.24.2logic_or_expr := logic_or_expr || logic_and_expr mg_24_2
G.25.1logic_and_expr := equality_expr mg_25_1
G.25.2logic_and_expr := logic_and_expr && equality_expr mg_25_2
L.1Library: int putchar(int); ml_1
L.2Library: int _putint(int); ml_2
L.3Library: int getchar(); ml_3
L.4Library: int puts(int); ml_4
L.5Library: int printf(int,...); support %%, %d, %c, and %s ml_5

Home