diff --git a/lexicalStructure b/lexicalStructure new file mode 100755 index 0000000..8817fe4 Binary files /dev/null and b/lexicalStructure differ diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 1e2b52c..22632ba 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -1,10 +1,12 @@ /* so we placed the citation here. */ /* definitions */ %option noyywrap + %{ #include "typedefs.h" %} + DIGIT [0-9] CHAR \\n|\\t|\\'|[^'\n\t\\] /* char can be a newline, tab, an escaped quote, or anything but a single quote, an actual line break, an actual tab, or a backslash by itself (to prevent confusion from escaped quote */ @@ -15,6 +17,7 @@ ENDCOM \*\) COMMENTCHAR [^\*]|\*[^\)] /*Making the contents of a comment anything that is either not a * or not a * followed by ) to terminate comments at the first ENDCOM */ %% + /* rules */ {DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );} @@ -43,4 +46,5 @@ int main( int argc, char **argv ) else yyin = stdin; yylex(); + } diff --git a/tests/test_keywards.alpha b/tests/test_keywards.alpha new file mode 100644 index 0000000..ff18168 --- /dev/null +++ b/tests/test_keywards.alpha @@ -0,0 +1,29 @@ +while +While +whiLe +if +IF +If +iF +then +Then +theN +else +eLse +elSe +Else +type +Type +tyPe +function +Function +functioN +return +Return +returN +external +External +exteRnal +as +As +aS diff --git a/tests/test_types.alpha b/tests/test_types.alpha new file mode 100644 index 0000000..4fde8cd --- /dev/null +++ b/tests/test_types.alpha @@ -0,0 +1,10 @@ +integer +Integer +address +Address +Boolean +boolean +character +Character +string +String