Skip to content

Instantly share code, notes, and snippets.

@rch
Created February 3, 2014 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rch/8791893 to your computer and use it in GitHub Desktop.
Save rch/8791893 to your computer and use it in GitHub Desktop.
Lepl Example
>>> value = Token(UnsignedReal())
>>> symbol = Token('[^0-9a-zA-Z \t\r\n]')
>>> number = Optional(symbol('-')) + value >> float
>>> add = number & ~symbol('+') & number > sum
>>> add.parse('12+30')
[42.0]
>>> add.parse('12 + -30')
[-18.0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment