lua-users home
lua-l archive

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

It was thus said that the Great Axel Kittenberger once stated:
> > Implementing this in a hand-written parser such as the one used by Lua is
> > left as an exercise for the reader :-)
> Keywords as table indexes aren't difficult, its just some extra code that:
> o when the parser is in a place it expects a table index
> oo that is after a dot.
> o it turns the keyword back into it original string meaning.
> But it is extra code, for most projects, we'd just go away, but Lua
> takes lot of care on its memory footprint and covering uncommon cases.
> When local variables are allowed to be identical to keywords as well,
> then the parser suddenly gets a magnitude more complex!
> locel end = 1
> if foocondition then end = end + 1 end
> Also gets the parser in our heads much more confused!
> I still guess there wouldn't be ambigous situations, though, for a
> parser with infinitely long lookahead.

  A very pathological case:

	if if == then then then = else else else = end end

  -spc (Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo [1])