Massive refactoring to simplify this whole setup. The Token List will be modified in place and reused in the Parser to normalize the list and generate a symbols table. Normalizing the token list will make sure the syntax is valid and the symbols table will have the relative offsets and length of symbol values. At least this is all the plan but one step at a time.
This commit is contained in:
+6
-7
@@ -6,6 +6,7 @@
|
||||
#include "../includes/list.h"
|
||||
#include "../includes/futil.h"
|
||||
#include "../includes/scanner.h"
|
||||
#include "../includes/parser.h"
|
||||
|
||||
int main(int argc, char* args[]) {
|
||||
if (argc == 1) {
|
||||
@@ -31,20 +32,16 @@ int main(int argc, char* args[]) {
|
||||
|
||||
if (t->Class == PunctuationClass){
|
||||
if(t->Value.Punctuation == NewLine) {
|
||||
printf("\n");
|
||||
printf("<%d>\n", t->LineNumber);
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("<%d>", t->LineNumber);
|
||||
|
||||
printf("%c ", t->Value.Punctuation);
|
||||
printf(" %c ", t->Value.Punctuation);
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("<%d>", t->LineNumber);
|
||||
|
||||
if (t->Class == LabelClass) {
|
||||
printf("[L]%s* ", t->Lemexe);
|
||||
printf("[L]%s*", t->Lemexe);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -79,5 +76,7 @@ int main(int argc, char* args[]) {
|
||||
}
|
||||
}
|
||||
|
||||
ParseTokens(list);
|
||||
|
||||
free(source_code);
|
||||
}
|
||||
Reference in New Issue
Block a user