From 5c9df58d1bf436ca73e99cf6722235bc9dea3446 Mon Sep 17 00:00:00 2001 From: Partho Bhattacharya Date: Tue, 4 Feb 2025 19:43:11 -0500 Subject: [PATCH] edited file to include comment lines and most of types in handout (except comments) --- lexicalStructure.lex | 76 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/lexicalStructure.lex b/lexicalStructure.lex index ef648ed..5989337 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -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 -%} -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 */ +/* %} */ + +/* 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 %%