Merge branch 'Dev' into Sprint1-TokenizeConstantsAndLiterals-FE-t#03
This commit is contained in:
BIN
lexicalStructure
Executable file
BIN
lexicalStructure
Executable file
Binary file not shown.
@ -1,10 +1,12 @@
|
|||||||
/* so we placed the citation here. */
|
/* so we placed the citation here. */
|
||||||
/* definitions */
|
/* definitions */
|
||||||
%option noyywrap
|
%option noyywrap
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
DIGIT [0-9]
|
DIGIT [0-9]
|
||||||
CHAR \\n|\\t|\\'|[^'\n\t\\]
|
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 */
|
/* 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 [^\*]|\*[^\)]
|
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 */
|
/*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 */
|
/* rules */
|
||||||
{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );}
|
{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );}
|
||||||
|
|
||||||
@ -43,4 +46,5 @@ int main( int argc, char **argv )
|
|||||||
else
|
else
|
||||||
yyin = stdin;
|
yyin = stdin;
|
||||||
yylex();
|
yylex();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
29
tests/test_keywards.alpha
Normal file
29
tests/test_keywards.alpha
Normal 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
10
tests/test_types.alpha
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
integer
|
||||||
|
Integer
|
||||||
|
address
|
||||||
|
Address
|
||||||
|
Boolean
|
||||||
|
boolean
|
||||||
|
character
|
||||||
|
Character
|
||||||
|
string
|
||||||
|
String
|
Reference in New Issue
Block a user