This repository has been archived on 2026-05-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
University-Basics-of-Progra…/Exercise 2/C/TestLexer.c
T
2023-05-09 14:51:15 +02:00

28 lines
677 B
C

#include <stdio.h>
#include "Lexer.h"
int start(char* sourcecode) {
if (sourcecode != NULL) {
return _GET_NEXT_CHARACTER_;
} else {
return _STOP_;
}
}
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;\"";
printf(sourcecode);
int lexer_state = _START_;
do {
switch (lexer_state) {
case _START_:
lexer_state = start(sourcecode);
break;
default: lexer_state = _ERROR_;
}
} while (lexer_state != _STOP_);
return 0;
}