lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2008/11/30 Eric Bohlman <ericbohlman@sbcglobal.net>:
> P^n - P^(m+1)

Ah! Never thought of that! Thanks.

Looks like there is some scope for optimisation there, though...

> d = lpeg.R"09"
> lpeg.print(d*d*d)
[]
00: set [(30-39)]-> FAIL
09: set [(30-39)]-> FAIL
18: set [(30-39)]-> FAIL
27: end
> lpeg.print(d^3-d^4)
[]
00: set [(30-39)]-> 47
09: choice -> 47 (1)
10: set [(30-39)]-> FAIL
19: set [(30-39)]-> FAIL
28: set [(30-39)]-> FAIL
37: span [(30-39)]
46: failtwice
47: set [(30-39)]-> FAIL
56: set [(30-39)]-> FAIL
65: set [(30-39)]-> FAIL
74: span [(30-39)]
83: end
> lpeg.print(d*d*d*d^-2)
[]
00: set [(30-39)]-> FAIL
09: set [(30-39)]-> FAIL
18: set [(30-39)]-> FAIL
27: set [(30-39)]-> 45
36: set [(30-39)]-> 45
45: end
> lpeg.print(d^3-d^6)
[]
00: set [(30-39)]-> 65
09: choice -> 65 (1)
10: set [(30-39)]-> FAIL
19: set [(30-39)]-> FAIL
28: set [(30-39)]-> FAIL
37: set [(30-39)]-> FAIL
46: set [(30-39)]-> FAIL
55: span [(30-39)]
64: failtwice
65: set [(30-39)]-> FAIL
74: set [(30-39)]-> FAIL
83: set [(30-39)]-> FAIL
92: span [(30-39)]
101: end

Paul