generated from yangdinglou/calc-slang
-
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.
Merge pull request #10 from cs4215-2023/ben-lester/parser
basic parser implementation
- Loading branch information
Showing
49 changed files
with
3,912 additions
and
1,535 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,4 @@ | ||
int a = 1; | ||
int b = 3+10; | ||
int c = a + b; | ||
int d = b + 10; |
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,3 @@ | ||
int c = 1; | ||
int d = 1 >> c; | ||
int e = 3 << 4; |
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,4 @@ | ||
for (int i = 0; i < 10; i++) { | ||
int a = 1; | ||
a += i; | ||
} |
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,11 @@ | ||
int foo(int a, int b) { | ||
int c = a+b; | ||
|
||
if (1) { | ||
a++; | ||
} else { | ||
b++; | ||
} | ||
} | ||
|
||
foo(1,2); |
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 @@ | ||
1 && 2; | ||
1 || 2; | ||
1 ^ 2; | ||
int a = 1; | ||
a && 2; |
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,2 @@ | ||
int a = 1; | ||
int *c = 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,3 @@ | ||
int* a; | ||
*a; | ||
&b; |
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,3 @@ | ||
int a = 0; | ||
a++; | ||
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,11 @@ | ||
int a = 1; | ||
|
||
for (int i = 0; i < 10; i++) { | ||
int b = 1; | ||
} | ||
|
||
if (1) { | ||
return 2; | ||
} else { | ||
return 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,44 @@ | ||
void main(int a) { | ||
int a = +1; | ||
a = -a; | ||
a++; | ||
int* b; | ||
*b; | ||
&b; | ||
|
||
int arr[5] = { 1, 2, 3, 4, 5 }; | ||
int *ptr = arr; | ||
ptr++; | ||
arr++; | ||
|
||
1 % 2; | ||
1 / 2; | ||
1 + 2; | ||
1 - 2; | ||
1 >> 1; | ||
1 << 2; | ||
|
||
a += 3; | ||
a -= 2; | ||
char full_name[] = "Drex"; | ||
for (int i = 0; i < 10; i++) { | ||
int a = 1; | ||
a += i; | ||
} | ||
|
||
int i =0; | ||
while(i <5){ | ||
i++; | ||
} | ||
|
||
do{ | ||
i--; | ||
} while(i > 0); | ||
|
||
char* string = "hello"; | ||
if (1) { | ||
i++; | ||
} else if (2) { | ||
i--; | ||
} | ||
} |
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,2 @@ | ||
yarn build; | ||
node ../dist/repl/repl.js -e "$(< $1)"; |
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,6 @@ | ||
int a = 1; | ||
!1; | ||
+1; | ||
-1; | ||
1 == !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,4 @@ | ||
void foo(){ | ||
int a = 3; | ||
int b = 3+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,4 @@ | ||
int i = 5; | ||
while (i--) { | ||
int a = 1; | ||
} |
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
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
Oops, something went wrong.