summaryrefslogtreecommitdiff
path: root/Homework/cs5300/project-three/data/TinyLexer.tokens
diff options
context:
space:
mode:
authorElizabeth Alexander Hunt <me@liz.coffee>2026-07-02 11:55:17 -0700
committerElizabeth Alexander Hunt <me@liz.coffee>2026-07-02 11:55:17 -0700
commit6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 (patch)
treeed97e39ec77c5231ffd2c394493e68d00ddac5a4 /Homework/cs5300/project-three/data/TinyLexer.tokens
downloadmisc-undergrad-6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6.tar.gz
misc-undergrad-6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6.zip
Diffstat (limited to 'Homework/cs5300/project-three/data/TinyLexer.tokens')
-rw-r--r--Homework/cs5300/project-three/data/TinyLexer.tokens41
1 files changed, 41 insertions, 0 deletions
diff --git a/Homework/cs5300/project-three/data/TinyLexer.tokens b/Homework/cs5300/project-three/data/TinyLexer.tokens
new file mode 100644
index 0000000..ad6b2a7
--- /dev/null
+++ b/Homework/cs5300/project-three/data/TinyLexer.tokens
@@ -0,0 +1,41 @@
+//
+// DO NOT MODIFY THIS FILE.
+//
+// This file describes the tokens that will be available to the parser
+// that uses the grammar described in Tiny.cfg.
+
+lexer grammar TinyLexer;
+
+IF : 'if' ;
+THEN : 'then' ;
+ELSE : 'else' ;
+END : 'end' ;
+REPEAT : 'repeat' ;
+UNTIL : 'until' ;
+READ : 'read' ;
+WRITE : 'write' ;
+OPAREN : '(' ;
+CPAREN : ')' ;
+
+PLUS: '+' ;
+MINUS: '-' ;
+MULTIPLY: '*' ;
+DIVIDE: '/' ;
+LT: '<' ;
+EQUAL: '=' ;
+
+NUM : DIGIT+ ;
+ID : LETTER+ ;
+
+COMMENT
+ : ( '//' ~[\r\n]* '\r'? '\n'
+ | '/*' .*? '*/'
+ ) -> skip
+ ;
+
+WS
+ : (' ' | '\t' | '\n' | '\r' | '\f')+ -> skip
+ ;
+
+fragment LETTER : ('a'..'z' | 'A'..'Z');
+fragment DIGIT : ('0'..'9'); \ No newline at end of file