edited file to include comment lines and most of types in handout (except comments)

This commit is contained in:
Partho Bhattacharya
2025-02-04 19:43:11 -05:00
parent 3bdf25f4e2
commit 5c9df58d1b

View File

@ -1,12 +1,70 @@
// Lexical Analysis with Flex (2.6.0) We used some of the code from this manual
// so we placed the citation here.
//definitions
%option noyywrap
%{
#include <typedefs.h>
%}
DIGIT [0-9]
ID [a-zA-Z][a-zA-Z0-9]*
/* Lexical Analysis with Flex (2.6.0) We used some of the code from this manual */
/* so we placed the citation here. */
/* definitions */
/* %option noyywrap */
/* %{ */
/* #include <typedefs.h> */
/* %} */
/* identifier */
ID 101 [a-zA-Z_][a-zA-Z0-9_]*
/* type names */
T_INTEGER 201 [0-9]*
T_ADDRESS 202
T_BOOLEAN 203 'true'|'false'
T_CHARACTER 204
T_STRING 205
/* constants (literals) */
C_INTEGER 301
C_NULL 302
C_CHARACTER 303
C_STRING 304
C_TRUE 305
C_FALSE 306
/* other keywords */
WHILE 401
IF 402
THEN 403
ELSE 404
TYPE 405
FUNCTION 406
RETURN 407
EXTERNAL 408
AS 409
/* punctuation - grouping */
L_PAREN 501
R_PAREN 502
L_BRACKET 503
R_BRACKET 504
L_BRACE 505
R_BRACE 506
/* punctuation - other */
SEMI_COLON 507
COLON 508
COMMA 509
ARROW 510
/* operators */
ADD 601
SUB_OR_NEG 602
MUL 603
DIV 604
REM 605
LESS_THAN 606
EQUAL_TO 607
ASSIGN 608
NOT 609
AND 610
OR 611
DOT 612
RESERVE 613
RELEASE 614
%%
//rules
%%