Yueliang


Introduction

The goal of Yueliang is to implement Lua 5 in Lua 5. Such a codebase, if well documented, can be a useful prototyping and educational tool. Initially, the focus is on the front end of Lua, i.e. the lexical analyzer, the parser and the code generator, in order to generate binary chunks. A port of the back end (the VM) is being worked on. Yueliang is moon in Mandarin.

The codebase is currently a no-brainer port of the Lua 5.0.3 front end and the Lua 5.1.3 front end. C source code was ported to Lua code in a brain dead manner, and the C heritage is retained as much as possible to allow for easy comparison. Due to certain implementation methods, processing might be slow (especially if the source file causes a lot of string processing.) The initial version is not meant to be fast. Even unused arguments are retained. Asserts are currently enabled. While the Lua code itself is portable, portions of the code is hard-coded to generate output for an x86-type platform (32-bit ints, doubles, little-endian.)

There is an automatic tester script to exercise the front end. Both the lexer and the parser have test suites, for both front end versions. There isn't any test suite for a back end yet because the back end is currently being ported, but much of Lua's test suite can be utilized for that. Yueliang currently produces the exact binary chunk as the original Lua 5 itself for hundreds of KB of various Lua scripts that I have on my machine. Performance (not currently a consideration) is 28 seconds on an Athlon 2500+, or about 29.5KB/sec, for Yueliang 0.1.0. (Native C is virtually instantaneous, so a comparison is pointless, really.)


Features

Yueliang includes the following:


Download

Project Links on LuaForge: Yueliang project page | File releases

Latest version: yueliang-0.2.4 (188KB zip)

What's new?

Current work being done:


Acknowledgements

Thanks to the LuaForge team for hosting this material. This page was written on SeaMonkey. Yueliang was developed using the SciTE editor on Cygwin, and managed using SVN. Much of Yueliang is based on the Lua sources.


This page Copyright © 2006-2008 KHMan. Last Revised: 2008-04-13.
Canonical URL: http://yueliang.luaforge.net/