From d11c9a5a7e3d872b401f243ffdc6440b3c3a23f8 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 22 Oct 2022 08:28:05 -0700 Subject: [PATCH] Improved parser --- .vscode/settings.json | 2 ++ README.md | 4 +--- lamb/parser.py | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 9381e55..6a0417c 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,9 @@ "cSpell.words": [ "autochurch", "freevar", + "mdel", "onefile", + "Packrat", "pyparsing", "runstatus", "subvar" diff --git a/README.md b/README.md index 016d270..3df1778 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ - $\alpha$-equivalence check - Prettyprint functions (combine args, rename bound variables) - Write a nice README - - Delete macros - Handle or avoid recursion errors ## Todo: @@ -17,8 +16,7 @@ - Warn when overwriting macro - Syntax highlighting: parenthesis, bound variables, macros, etc - Pin header to top of screen - - Parser is a bit slow. Maybe we can do better? - - pypi package + - PyPi package ## Mention in Docs - lambda functions only work with single-letter arguments diff --git a/lamb/parser.py b/lamb/parser.py index afeca05..b0a49d4 100755 --- a/lamb/parser.py +++ b/lamb/parser.py @@ -1,5 +1,8 @@ import pyparsing as pp +# Packrat gives a MAD speed boost. +pp.ParserElement.enablePackrat() + import lamb.tokens as tokens import lamb.utils as utils