lua-users home
lua-l archive

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


On Thu, Nov 29, 2012 at 6:43 AM, Chris Babcock <cbabcock@asciiking.com> wrote:
> I have an existing DSL (Diplomacy orders) for which I need to
> implement a parser. The language specification consists of a syntax
> document and a vocabulary document:

So, the grammar itself is very simple: there are orders, which can be
delimited by newlines, commas or semicolons.

There is a 'delayed order' which has a conditiional clause.

So, rather than making a really complicated grammar, use the smallest
possible one, and work with the abstract syntax tree to verify it.

It's _almost_ simple enough to just use Lua patterns, except for the
conditional expressions...

> And thank you, Steve Donovan, for the wiki article:

Thanks - it came out of my attempt to _learn_ LPeg ;)

steve d.