diff options
author | Lizzy Hunt <lizzy.hunt@usu.edu> | 2024-02-28 15:06:00 -0700 |
---|---|---|
committer | Lizzy Hunt <lizzy.hunt@usu.edu> | 2024-02-28 15:06:00 -0700 |
commit | 55c00566b0c4870d4c4409ab3e93aacf74f8d081 (patch) | |
tree | 4226b7e518a3ab88987d544ea892da42952255ee /src/parser | |
parent | d39cf84965dffd11cab440f5a4efa1b16932ba73 (diff) | |
download | cps-interpreter-55c00566b0c4870d4c4409ab3e93aacf74f8d081.tar.gz cps-interpreter-55c00566b0c4870d4c4409ab3e93aacf74f8d081.zip |
identity function, repl upgrade
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/grammar.pegjs | 2 | ||||
-rw-r--r-- | src/parser/parser.ts | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/parser/grammar.pegjs b/src/parser/grammar.pegjs index e237af9..f586dcc 100644 --- a/src/parser/grammar.pegjs +++ b/src/parser/grammar.pegjs @@ -86,7 +86,7 @@ SwitchExpression RPAREN { return { switch: { switchIndex, continuations } }; } ApplicationExpression - = APP _? LPAREN _? fn:Value _? COMMA _? args:ValueList _? RPAREN { + = APP _? LPAREN _? fn:(LabelStatement / VarStatement) _? COMMA _? args:ValueList _? RPAREN { return { application: { fn, args } }; } diff --git a/src/parser/parser.ts b/src/parser/parser.ts index 500a763..b196866 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -1716,7 +1716,12 @@ peg$parseApplicationExpression() { s4 = null; } // @ts-ignore - s5 = peg$parseValue(); + s5 = peg$parseLabelStatement(); +// @ts-ignore + if (s5 === peg$FAILED) { +// @ts-ignore + s5 = peg$parseVarStatement(); + } // @ts-ignore if (s5 !== peg$FAILED) { // @ts-ignore @@ -5337,7 +5342,7 @@ export type SwitchExpression = { switch: { switchIndex: Value; continuations: ContinuationList }; }; export type ApplicationExpression = { - application: { fn: Value; args: ValueList }; + application: { fn: LabelStatement | VarStatement; args: ValueList }; }; export type FixBinding = [ LPAREN, |