[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Can LPeg do basic arithmetic?
- From: Sean Conner <sean@...>
- Date: Tue, 5 Jul 2016 16:18:44 -0400
It was thus said that the Great Soni L. once stated:
> As you may or may not know by now, regex can do basic arithmetic, with
> unary integers.[1] Can LPeg do better, say with binary integers, or
> binary floats, or even full-blown decimal?
Yup. You can do the regex approach with a substitution capture
(lpeg.Cs()) or even a full blown calculator (there's an example on the LPeg
web page).
-spc (For more fun, write an LPeg expression that can run compiled Lua
code ... )