lua-users home
lua-l archive

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


> I know that an early version of Lua used Bison and Flex and that Bison 
> and Flex were not used later.
> 
> I am just curious, was the original parser/lexer that was outputted 
> scraped completely or did it still have valuable code that just needed 
> to be hand altered afterwards?

The Lua lexer was initially (Lua 1.0) written with lex but soon (Lua 1.1)
replaced by a handwritten one for performance, especially in the conversion
of floating-point numbers.

The Lua parser was rewriten from scratch in Lua 3.1 as a recursive descent
parser to avoid portability, quality, and reentrancy problems in the
yacc-generated code and also to allow better error messages.

By that time, the syntax of Lua was pretty much stable and a handwritten
parser wasn't a maintenance nightmare.

All this is mentioned in the Lua chapter of the book "Masterminds of
Programming: Conversations with the Creators of Major Programming
Languages" and also in the paper "The implementation of Lua 5.0".