[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: OT(slightly): parser generator for expression with custom operators
- From: Wesley Smith <wesley.hoke@...>
- Date: Wed, 29 Jun 2011 09:54:43 -0700
Sounds like there are a range of options for what you need. If you
can make do with the Lua metamethods and a little string substitution,
I would definitely stick with a pure Lua implementation. However, if
you need to define a syntax that can't be handled by existing Lua
mechanisms, you can write a simple grammar and interpret the AST
yourself. I have had to do this for a couple of projects, which is
why I wrote the codepeg[1] module. It can automatically generate a
parser from a grammar specification.
wes
[1] https://github.com/weshoke/codepeg