summaryrefslogtreecommitdiff
path: root/src/interpreter
diff options
context:
space:
mode:
authorLizzy Hunt <elizabeth.hunt@simponic.xyz>2024-03-11 16:22:06 -0600
committerLizzy Hunt <elizabeth.hunt@simponic.xyz>2024-03-11 16:22:06 -0600
commit32879581e53fae5e684c24b44433172d8375d69e (patch)
tree307551e59409c2f01168e5fabeff200319c18aa7 /src/interpreter
parent4da17f6dedb4475c7730bdeab9ad3e339f0bfdee (diff)
downloadthe-abstraction-engine-32879581e53fae5e684c24b44433172d8375d69e.tar.gz
the-abstraction-engine-32879581e53fae5e684c24b44433172d8375d69e.zip
support underscores in function application, add sign entity
Diffstat (limited to 'src/interpreter')
-rw-r--r--src/interpreter/PeggyParser.js2
-rw-r--r--src/interpreter/parser.ts8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/interpreter/PeggyParser.js b/src/interpreter/PeggyParser.js
index 121cf9d..f5376b3 100644
--- a/src/interpreter/PeggyParser.js
+++ b/src/interpreter/PeggyParser.js
@@ -215,7 +215,7 @@ export default (function () {
var peg$c2 = ".";
var peg$c3 = "\r\n";
- var peg$r0 = /^[a-zA-Z0-9]/;
+ var peg$r0 = options.allowUnderscores ? /^[a-zA-Z0-9_]/ : /^[a-zA-Z0-9]/;
var peg$r1 = /^[\\\u03BB]/;
var peg$r2 = /^[\t-\n ]/;
diff --git a/src/interpreter/parser.ts b/src/interpreter/parser.ts
index 5e3be0f..930b953 100644
--- a/src/interpreter/parser.ts
+++ b/src/interpreter/parser.ts
@@ -30,6 +30,10 @@ export const isVariable = (term: LambdaTerm): term is Variable => {
return typeof term === "string";
};
-export const parse = (term: string, library = false) => {
- return peggyParser.parse(term, { peg$library: library });
+export const parse = (
+ term: string,
+ allowUnderscores = false,
+ library = false
+) => {
+ return peggyParser.parse(term, { peg$library: library, allowUnderscores });
};