-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a279b55
commit a1e996f
Showing
6 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
Program (1) | ||
ExtDefList (1) | ||
ExtDef (1) | ||
Specifier (1) | ||
TYPE: int | ||
ExtDecList (1) | ||
VarDec (1) | ||
ID: count | ||
SEMI | ||
ExtDefList (2) | ||
ExtDef (2) | ||
Specifier (2) | ||
TYPE: int | ||
FunDec (2) | ||
ID: main | ||
LP | ||
RP | ||
CompSt (2) | ||
LC | ||
DefList (3) | ||
Def (3) | ||
Specifier (3) | ||
TYPE: int | ||
DecList (3) | ||
Dec (3) | ||
VarDec (3) | ||
ID: res | ||
ASSIGN | ||
Exp (3) | ||
ID: fact | ||
LP | ||
Args (3) | ||
Exp (3) | ||
INT: 10 | ||
RP | ||
SEMI | ||
DefList (4) | ||
Def (4) | ||
Specifier (4) | ||
TYPE: int | ||
DecList (4) | ||
Dec (4) | ||
VarDec (4) | ||
ID: c | ||
ASSIGN | ||
Exp (4) | ||
INT: 3 | ||
COMMA | ||
DecList (4) | ||
Dec (4) | ||
VarDec (4) | ||
ID: d | ||
ASSIGN | ||
Exp (4) | ||
INT: 5 | ||
SEMI | ||
StmtList (5) | ||
Stmt (5) | ||
RETURN | ||
Exp (5) | ||
ID: res | ||
SEMI | ||
RC | ||
ExtDefList (8) | ||
ExtDef (8) | ||
Specifier (8) | ||
TYPE: int | ||
FunDec (8) | ||
ID: fact | ||
LP | ||
VarList (8) | ||
ParamDec (8) | ||
Specifier (8) | ||
TYPE: int | ||
VarDec (8) | ||
ID: a | ||
RP | ||
CompSt (8) | ||
LC | ||
StmtList (9) | ||
Stmt (9) | ||
IF | ||
LP | ||
Exp (9) | ||
Exp (9) | ||
ID: a | ||
EQ | ||
Exp (9) | ||
INT: 1 | ||
RP | ||
Stmt (9) | ||
CompSt (9) | ||
LC | ||
StmtList (10) | ||
Stmt (10) | ||
RETURN | ||
Exp (10) | ||
INT: 1 | ||
SEMI | ||
RC | ||
StmtList (12) | ||
Stmt (12) | ||
RETURN | ||
Exp (12) | ||
Exp (12) | ||
ID: fact | ||
LP | ||
Args (12) | ||
Exp (12) | ||
Exp (12) | ||
ID: a | ||
MINUS | ||
Exp (12) | ||
INT: 1 | ||
RP | ||
MUL | ||
Exp (12) | ||
ID: a | ||
SEMI | ||
RC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
int count; | ||
int main(){ | ||
int res = fact(10); | ||
int c = 3, d = 5; | ||
return res; | ||
} | ||
|
||
int fact(int a){ | ||
if(a == 1){ | ||
return 1; | ||
} | ||
return fact(a - 1) * a; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
Program (1) | ||
ExtDefList (1) | ||
ExtDef (1) | ||
Specifier (1) | ||
StructSpecifier (1) | ||
STRUCT | ||
ID: struct_1 | ||
LC | ||
DefList (3) | ||
Def (3) | ||
Specifier (3) | ||
TYPE: int | ||
DecList (3) | ||
Dec (3) | ||
VarDec (3) | ||
ID: num | ||
SEMI | ||
DefList (4) | ||
Def (4) | ||
Specifier (4) | ||
TYPE: char | ||
DecList (4) | ||
Dec (4) | ||
VarDec (4) | ||
ID: value | ||
SEMI | ||
DefList (5) | ||
Def (5) | ||
Specifier (5) | ||
TYPE: float | ||
DecList (5) | ||
Dec (5) | ||
VarDec (5) | ||
VarDec (5) | ||
ID: res | ||
LB | ||
INT: 10 | ||
RB | ||
SEMI | ||
RC | ||
SEMI | ||
ExtDefList (7) | ||
ExtDef (7) | ||
Specifier (7) | ||
TYPE: int | ||
FunDec (7) | ||
ID: test_struct | ||
LP | ||
VarList (7) | ||
ParamDec (7) | ||
Specifier (7) | ||
TYPE: int | ||
VarDec (7) | ||
ID: num | ||
RP | ||
CompSt (8) | ||
LC | ||
DefList (9) | ||
Def (9) | ||
Specifier (9) | ||
StructSpecifier (9) | ||
STRUCT | ||
ID: struct_1 | ||
DecList (9) | ||
Dec (9) | ||
VarDec (9) | ||
ID: obj | ||
SEMI | ||
StmtList (10) | ||
Stmt (10) | ||
Exp (10) | ||
Exp (10) | ||
Exp (10) | ||
ID: obj | ||
DOT | ||
ID: num | ||
ASSIGN | ||
Exp (10) | ||
ID: num | ||
SEMI | ||
StmtList (11) | ||
Stmt (11) | ||
Exp (11) | ||
Exp (11) | ||
Exp (11) | ||
Exp (11) | ||
ID: obj | ||
DOT | ||
ID: res | ||
LB | ||
Exp (11) | ||
INT: 1 | ||
RB | ||
ASSIGN | ||
Exp (11) | ||
FLOAT: 2.3 | ||
SEMI | ||
RC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
struct struct_1 | ||
{ | ||
int num; | ||
char value; | ||
float res[10]; | ||
}; | ||
int test_struct(int num) | ||
{ | ||
struct struct_1 obj; | ||
obj.num = num; | ||
obj.res[1] = 2.3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Error type A at Line 6: unknown lexeme 'breaking my own rules' | ||
Error type A at Line 9: unknown lexeme 5the | ||
Error type A at Line 10: unknown lexeme '\n' | ||
Error type B at Line 12: syntax error, probably Missing SEMI | ||
Error type B at Line 15: syntax error, probably missing RP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
int poor(){ | ||
(mercy = mercy) || (on)*me; | ||
set&&fire = 2!=history+0; | ||
} | ||
char I(){ | ||
int m = 'breaking my own rules'; | ||
I = ' '+m == crying + as + a +fool; | ||
Tall * stories >= (on[the] - page); | ||
-Short.glories_on 5the faint; | ||
{I / m && close - enough='\n'=to >=touch;} | ||
{ | ||
int but - I = never || cared + for +love; | ||
{ | ||
It - 's' < a > church && of - burnt * romances; | ||
and = I = 'm' /(-2 -4 -got||to -pray( | ||
|
||
it [s] = a, solo(song), and + it[s] || only (for, the=brave));{ | ||
} | ||
} | ||
} | ||
} |