diff --git a/PLATYPUS_Regex.md b/PLATYPUS_Regex.md index f98d368..0f0fa29 100644 --- a/PLATYPUS_Regex.md +++ b/PLATYPUS_Regex.md @@ -10,9 +10,9 @@ L(KEYWORD) = PLATYPUS | IF | THEN | ELSE | USING | REPEAT | INPUT | OUTPUT ``` ## Variable Identifiers ``` -L(LETTER) = [a-zA-Z] +L(L) = [a-zA-Z] -L(LETTER_OR_DIGIT) = [a-zA-Z0-9] +L(LoD) = [a-zA-Z0-9] L(VID) = AVID | SVID @@ -24,24 +24,24 @@ L(SVID) = AVID# ## Integer Literals ``` -L(DEC_INT_LITERAL) = [0-9]* +L(DIL) = 0 | [1-9]* -L(NON_ZERO_DIGIT) = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 +L(NzD) = [1-9] -L(DIGIT) = [0-9]+ +L(D) = [0-9] -L(OCT_DIGIT) = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 +L(OD) = [0-7] -L(OCT_DIGIT_LITERAL) = 0(OCT_DIGIT)+ +L(OIL) = 0([0-7])* -L(INT_LITERAL) = (DEC_INT_LITERAL | OCT_INT_LITERAL) +L(IL) = (DIL | OIL) ``` ## Floating Point Literal ``` -L(FLP_LITERAL) = ([0-9]*).([0-9]+) +L(FLPL) = (0 | [1-9]*).[0-9]* ``` ## String Literal ``` -L(STR_LITERAL) = "([a-ZA-Z_0-9])*" +L(STRL) = "([a-ZA-Z_0-9])*" ``` \ No newline at end of file diff --git a/PLATYPUS_Transition_Table.xlsx b/PLATYPUS_Transition_Table.xlsx new file mode 100644 index 0000000..469e3ff Binary files /dev/null and b/PLATYPUS_Transition_Table.xlsx differ diff --git a/table.h b/table.h index 052ab0c..c0bf28d 100755 --- a/table.h +++ b/table.h @@ -1,5 +1,5 @@ /* Filename: table.h - * Transition Table and function declarations necessary for the scanner implementation + * Transition Table and function declarations necessary for the scanner implementation * as required for CST8152 - Assignment #2. * Version: 1.17.1 * Date: 30 January 2017 @@ -21,60 +21,101 @@ #include <_null.h> /* NULL pointer constant is defined there */ #endif -/* Source end-of-file (SEOF) sentinel symbol - * '\0' or only one of the folowing constants: 255, 0xFF , EOF - */ + /* Source end-of-file (SEOF) sentinel symbol + * '\0' or only one of the folowing constants: 255, 0xFF , EOF + */ -/* Single-lexeme tokens processed separately one by one - * in the token-driven part of the scanner - * '=' , ' ' , '(' , ')' , '{' , '}' , == , <> , '>' , '<' , - * space - * ! , '>' , '<' , + * space + * !