diff options
| author | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-07-02 11:55:17 -0700 |
|---|---|---|
| committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-07-02 11:55:17 -0700 |
| commit | 6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 (patch) | |
| tree | ed97e39ec77c5231ffd2c394493e68d00ddac5a4 /Homework/cs5300/project-three/out/production/p3-parser/data | |
| download | misc-undergrad-6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6.tar.gz misc-undergrad-6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6.zip | |
Diffstat (limited to 'Homework/cs5300/project-three/out/production/p3-parser/data')
24 files changed, 221 insertions, 0 deletions
diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/Expr.cfg b/Homework/cs5300/project-three/out/production/p3-parser/data/Expr.cfg new file mode 100644 index 0000000..7493e3e --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/Expr.cfg @@ -0,0 +1,25 @@ +// +// DO NOT MODIFY THIS FILE. +// +// This file contains an expression grammar that uses tokens described in +// ExprLexer.tokens. + +grammar Expr; + +goal: expr; + +expr: expr PLUS term + | expr MINUS term + | term + ; + +term : term MULTIPLY factor + | term DIVIDE factor + | factor + ; + +factor: OPAREN expr CPAREN + | INT + | FLOAT + | IDENTIFIER + ;
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/ExprLexer.tokens b/Homework/cs5300/project-three/out/production/p3-parser/data/ExprLexer.tokens new file mode 100644 index 0000000..ccb798a --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/ExprLexer.tokens @@ -0,0 +1,39 @@ +// +// DO NOT MODIFY THIS FILE. +// +// This file describes the tokens that will be available to the parser +// that uses the grammar described in Expr.cfg. + +lexer grammar ExprLexer; + +PLUS: '+' ; +MINUS: '-' ; +MULTIPLY: '*' ; +DIVIDE: '/' ; +OPAREN: '(' ; +CPAREN: ')' ; + +FLOAT + : DIGIT+ '.' DIGIT+ + ; + +INT + : DIGIT+ + ; + +IDENTIFIER + : LETTER (LETTER | DIGIT)* + ; + +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 diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/Paren.cfg b/Homework/cs5300/project-three/out/production/p3-parser/data/Paren.cfg new file mode 100644 index 0000000..184b11c --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/Paren.cfg @@ -0,0 +1,17 @@ +// +// DO NOT MODIFY THIS FILE. +// +// This file contains an expression grammar that uses tokens described in +// ParenLexer.tokens. + +grammar Paren; + +goal: list; + +list: list pair + | pair + ; + +pair: OPAREN list CPAREN + | OPAREN CPAREN + ; diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/ParenLexer.tokens b/Homework/cs5300/project-three/out/production/p3-parser/data/ParenLexer.tokens new file mode 100644 index 0000000..51e5258 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/ParenLexer.tokens @@ -0,0 +1,19 @@ +// +// DO NOT MODIFY THIS FILE. +// +// This file describes the tokens that will be available to the parser +// that uses the grammar described in Paren.cfg. + +lexer grammar ParenLexer; + +OPAREN + : '(' + ; + +CPAREN + : ')' + ; + +WS + : (' ' | '\t' | '\n' | '\r' | '\f')+ -> skip + ; diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/Simple.cfg b/Homework/cs5300/project-three/out/production/p3-parser/data/Simple.cfg new file mode 100644 index 0000000..80c1e18 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/Simple.cfg @@ -0,0 +1,13 @@ +// +// DO NOT MODIFY THIS FILE. +// +// This file contains an expression grammar that uses tokens described in +// ParenLexer.tokens. + +grammar Simple; + +G: N; + +N: N X + | X + ; diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/SimpleLexer.tokens b/Homework/cs5300/project-three/out/production/p3-parser/data/SimpleLexer.tokens new file mode 100644 index 0000000..64ec3c1 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/SimpleLexer.tokens @@ -0,0 +1,15 @@ +// +// DO NOT MODIFY THIS FILE. +// +// This file describes the tokens that will be available to the parser +// that uses the grammar described in Simple.cfg. + +lexer grammar SimpleLexer; + +X + : 'x' + ; + +WS + : (' ' | '\t' | '\n' | '\r' | '\f')+ -> skip + ; diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/Tiny.cfg b/Homework/cs5300/project-three/out/production/p3-parser/data/Tiny.cfg new file mode 100644 index 0000000..a7a28a3 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/Tiny.cfg @@ -0,0 +1,19 @@ +// +// WRITE A CORRECT GRAMMAR FOR THE TINY LANGUAGE IN THIS FILE. +// +// The grammar is described in data/tinyGrammar.pdf. Do not use dashes +// in your non-terminal names. I recommend you use mixed case naming for your +// non-terminals instead (e.g. stmtSeq). +// +// Do not put any string literals in this grammar (e.g. "="). Use only token +// names given in TinyLexer.tokens. +// +// This file contains an expression grammar that uses tokens described in +// TinyLexer.tokens. +// +// NOTE ONE ERROR in the pdf: the second production rule should read: +// stmt-seq -> stmt-seq stmt | stmt + +grammar Tiny; + +goal: program; diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/TinyLexer.tokens b/Homework/cs5300/project-three/out/production/p3-parser/data/TinyLexer.tokens new file mode 100644 index 0000000..ad6b2a7 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/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 diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/expr1.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/expr1.dat new file mode 100644 index 0000000..846e7d3 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/expr1.dat @@ -0,0 +1 @@ +3 + 4 * 5 / 8
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/expr2.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/expr2.dat new file mode 100644 index 0000000..8e0c0b7 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/expr2.dat @@ -0,0 +1 @@ +3 + + 42 * 34
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/expr3.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/expr3.dat new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/expr3.dat @@ -0,0 +1 @@ +3 diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/expr4.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/expr4.dat new file mode 100644 index 0000000..84a357a --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/expr4.dat @@ -0,0 +1 @@ +(a + b) * ((c-def)/43)
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/expr5.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/expr5.dat new file mode 100644 index 0000000..c2c433b --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/expr5.dat @@ -0,0 +1 @@ +(a + b) * ((c-d)/43 diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/expr6.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/expr6.dat new file mode 100644 index 0000000..f46d387 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/expr6.dat @@ -0,0 +1 @@ +(
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/paren0.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/paren0.dat new file mode 100644 index 0000000..dd626a0 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/paren0.dat @@ -0,0 +1 @@ +()
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/paren1.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/paren1.dat new file mode 100644 index 0000000..f7e9493 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/paren1.dat @@ -0,0 +1,3 @@ +(( +))( +)(((()))()(()))
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/paren2.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/paren2.dat new file mode 100644 index 0000000..4f879eb --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/paren2.dat @@ -0,0 +1,3 @@ +( +))( +)
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/paren3.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/paren3.dat new file mode 100644 index 0000000..e4a2fe8 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/paren3.dat @@ -0,0 +1 @@ +)()( diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/paren4.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/paren4.dat new file mode 100644 index 0000000..3077d74 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/paren4.dat @@ -0,0 +1 @@ +()()(()()) diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/tiny1.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/tiny1.dat new file mode 100644 index 0000000..7f9078f --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/tiny1.dat @@ -0,0 +1,3 @@ +a = 3 +b = 4 +c = a + b diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/tiny2.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/tiny2.dat new file mode 100644 index 0000000..09195b8 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/tiny2.dat @@ -0,0 +1,7 @@ +a = 3 +b = 4 +if a = b then + write (a + b * (c - d)) +else + write a +end
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/tiny3.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/tiny3.dat new file mode 100644 index 0000000..768addd --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/tiny3.dat @@ -0,0 +1,4 @@ +a = 3 +if a = then + write a +end
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/tiny4.dat b/Homework/cs5300/project-three/out/production/p3-parser/data/tiny4.dat new file mode 100644 index 0000000..1d66283 --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/tiny4.dat @@ -0,0 +1,4 @@ +a = 3 +if (a = b) then + write a = 3) +end
\ No newline at end of file diff --git a/Homework/cs5300/project-three/out/production/p3-parser/data/tinyGrammar.pdf b/Homework/cs5300/project-three/out/production/p3-parser/data/tinyGrammar.pdf Binary files differnew file mode 100644 index 0000000..855d45b --- /dev/null +++ b/Homework/cs5300/project-three/out/production/p3-parser/data/tinyGrammar.pdf |
