Regex for capturing lambda terms
I'm making a program to interpret lambda calculus, so I wanted to make a regex to break up input into lambda terms.
I came up with this: https://regex101.com/r/LXsq4n/3
and it works fine. However, when I use this exact regex in Python 3 on the test string, i.e.:
re.findall(r"\\[a-z][0-9]*\.([a-z][0-9]*|[ \\\.])*([a-z][0-9]*|[\\\.])|[a-z][0-9]*|\(([^()]|(?R))*\)", r"\x.x (a b) (\x.x (c c))")
I get an error saying "unexpected end of pattern". Does anyone know what I'm doing wrong?
Posted Jul 21, 2017, 9:52 PM UTC · edited
23