Merge branch 'Dev' into Sprint1-TokenizeConstantsAndLiterals-FE-t#03

This commit is contained in:
Annie Slenker
2025-02-11 16:36:04 -05:00
committed by GitHub
4 changed files with 43 additions and 0 deletions

BIN
lexicalStructure Executable file

Binary file not shown.

View File

@ -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();
}

29
tests/test_keywards.alpha Normal file
View File

@ -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

10
tests/test_types.alpha Normal file
View File

@ -0,0 +1,10 @@
integer
Integer
address
Address
Boolean
boolean
character
Character
string
String