Exercise 2 + 3 #4
@@ -0,0 +1,31 @@
|
|||||||
|
#include "Lexer.h"
|
||||||
|
|
||||||
|
int start(char* src) {
|
||||||
|
// if (src != NULL) {
|
||||||
|
// return _GET_NEXT_CHARACTER_;
|
||||||
|
// } else {
|
||||||
|
// return _STOP_;
|
||||||
|
// }
|
||||||
|
|
||||||
|
return _STOP_; // placeholder
|
||||||
|
}
|
||||||
|
|
||||||
|
int getNextCharacter() {
|
||||||
|
return _STOP_; // placeholder
|
||||||
|
}
|
||||||
|
|
||||||
|
int readIdentifier() {
|
||||||
|
return _STOP_; // placeholder
|
||||||
|
}
|
||||||
|
|
||||||
|
int readNumLit() {
|
||||||
|
return _STOP_; // placeholder
|
||||||
|
}
|
||||||
|
|
||||||
|
int readOperator() {
|
||||||
|
return _STOP_; // placeholder
|
||||||
|
}
|
||||||
|
|
||||||
|
int readPunctuation() {
|
||||||
|
return _STOP_; // placeholder
|
||||||
|
}
|
||||||
@@ -1,35 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "Lexer.h"
|
#include "Lexer.h"
|
||||||
|
#include "Lexer.c"
|
||||||
int start(char* sourcecode) {
|
|
||||||
// if (sourcecode != NULL) {
|
|
||||||
// return _GET_NEXT_CHARACTER_;
|
|
||||||
// } else {
|
|
||||||
// return _STOP_;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return _STOP_; // placeholder
|
|
||||||
}
|
|
||||||
|
|
||||||
int getNextCharacter() {
|
|
||||||
return _STOP_; // placeholder
|
|
||||||
}
|
|
||||||
|
|
||||||
int readIdentifier() {
|
|
||||||
return _STOP_; // placeholder
|
|
||||||
}
|
|
||||||
|
|
||||||
int readNumLit() {
|
|
||||||
return _STOP_; // placeholder
|
|
||||||
}
|
|
||||||
|
|
||||||
int readOperator() {
|
|
||||||
return _STOP_; // placeholder
|
|
||||||
}
|
|
||||||
|
|
||||||
int readPunctuation() {
|
|
||||||
return _STOP_; // placeholder
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char* sourcecode = "Hello World the second - I coded this before. So yeah, FOXES ARE SUPERIOR.\nBut the professor wants us to write the following: \"index = 2 * count + 42;\"\n\n";
|
char* sourcecode = "Hello World the second - I coded this before. So yeah, FOXES ARE SUPERIOR.\nBut the professor wants us to write the following: \"index = 2 * count + 42;\"\n\n";
|
||||||
@@ -60,7 +31,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
} while (lexer_state != _STOP_);
|
} while (lexer_state != _STOP_);
|
||||||
|
|
||||||
printf("Lexer exited with code ");
|
// printf("Lexer exited with code ");
|
||||||
// printf(lexer_state);
|
// printf(lexer_state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user