HOLDUP DID I COOK (dieLog #2)
Finished : automatic “INDENT” and “DEDENT”
- enables codegen to space out blocks of code.
: “IF” statement
- uses the new automatic system trough recusion
: MAIN() function search
- for stzarting function for a basic C sytax.
: Math OPERATORS
- such as “is” “is_not” “grater_than” less than… you get the point.
Since in suffer levels 1 and 2 are used basic symbol types “<,>” etc, i didnt bother much checking the correctnbes of the implementation.
CODE EXAMPLE (with the new stuff):
-fineLang ->
SUFFER: two
;
FUNCTION main():
let x = 5
if x > 3:
print(x)
if x > 4:
print(x)
let y = 6
if (x add y > 10):
print(“hi”)
- to C ->
#include <stdio.h>
int main() {
int x = 5;
if (x > 3) {
printf(“%d\n”, x);
if (x > 4) {
printf(“%d\n”, x);
int y = 6;
if (x + y > 10) {
printf(“hi\n”);
}
}
}
}
INTO THE ULTIMATE COMPILED STATE ->
5
5
hi
To be honest.
this was a very complicated test case, and i wouldnt lie if i said that If this fails i wouldnt be surprised
THATS IT FOR TODAY!! thanks you for your time and have a nice day :>)
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.