lua-users home
lua-l archive

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


Edgar Toernig wrote:
> It may sound weird by I was thinking about that when I was
> looking for a nice and powerful case statement: precompiled
> lex-like finite automatons as a super case statement.

You may want to have a look at how pattern matching in Haskell
works. Also check their lazy regex combinators.

One idea is to integrate the pattern matching language into the
core language. Then you can easily tag captures with variable
names and make them available to the bodies. This also simplifies
compiling and optimizing the pattern matches together with the
core language constructs.

But I guess it would look really ugly in any language with an
Algol-like syntax (such as Lua).