lua-users home
lua-l archive

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


on 2/25/05 1:08 PM, David Given at dg@cowlark.com wrote:

> Object = {...description of object...}
> 
> o1 = Object
> o2 = green Object
> o3 = large green Object
> o4 = sparkly large green Object
> 
> ...where green, large and sparkly are functions that take a single parameter,
> examine their contents, and return a new table based on those contents.

By what syntactic rule would you recognize that this was the correct
parsing? You have no type information available about any of the keywords
above. How would you distinguish between a parsing of:

    sparkly( large )
    green( Object )

As opposed to:

    sparkly( large( green( Object ) ) )

Lua's recognition of strings and tables as alternative parameter lists is a
simple part of the grammar -- if one is looking for a parameter list, look
for "(" or "{" or a string -- and is impressively powerful when it comes to
doing data description.

Mark