diff --git a/src/table.c b/src/table.c index 6968a18..56132c7 100644 --- a/src/table.c +++ b/src/table.c @@ -23,31 +23,41 @@ void fillTable() { } // Skip whitespace - table[START][' '] = START; + table[7][' '] = 7; // If we reach a newline, and are not in the middle of a statement, accept - table[START]['\n'] = ACCEPT; + table[7]['\n'] = ACCEPT; // Accept the statement "go" - table[START]['g'] = 1; + table[7]['g'] = 1; table[1]['o'] = 2; table[2]['\n'] = ACCEPT; - table[2][' '] = START; + table[2][' '] = 7; - table[START]['d'] = 1; + table[7]['d'] = 1; table[1]['x'] = 2; table[1]['y'] = 2; table[2]['='] = 3; table[3]['-'] = 4; - for (int i = '0'; i <='9'; i++) { + for (int i = '0'; i <= '9'; i++) { table[3][i] = 5; table[4][i] = 5; table[5][i] = 5; } table[5]['\n'] = ACCEPT; - table[5][' '] = START; + table[5][' '] = 7; + for (int i = '0'; i <= '9'; i++) { + table[START][i] = 6; + table[6][i] = 6; + } + table[6][':'] = 7; + + table[START][' '] = START; + table[START]['\n'] = ACCEPT; + table[START]['g'] = 1; + table[START]['d'] = 1; // TODO Expand the table to pass (and fail) the described syntax // table[...][...] = ...