franko / luajit-lang-toolkit

A Lua bytecode compiler written in Lua itself for didactic purposes or for new language implementations
Other
652 stars 91 forks source link

Fixed build on OS X. #19

Closed secondwtq closed 9 years ago

secondwtq commented 9 years ago

According to LuaJIT official documentation, building executable with LuaJIT on OS X needs adding flags -pagezero_size 10000 -image_base 100000000 to linker, or it would fail when creating Lua state.

franko commented 9 years ago

Hi,

thank you for the pull request. I will be happy to merge the fix to the makefile but there is a problems with the changes related to the luacode-generator.

Do you think you could turn your changes so that the user can choose the backend (bytecode vs code generation) using a specific flag from the command line invocation?

With the change you propose the luacode-generator will be activated by default and I prefer to leave the bytecode generator by default. In addition I’m wondering if printing the original output is ok when you are using the bytecode generator since a binary blob is generated.

franko commented 9 years ago

I take also the opportunity to ask you if you are potentially interested in the branch bc-standalone-exec. This latter creates a stand-alone executable by compiling the lang/* modules as bytecode and including them in the executable. I never merged the branch because I was not sure if there was an interest in this kind of build.

secondwtq commented 9 years ago

Well I just forked this to play with the lexer and parser, and I found this problem while building it, but I don't know why my newer commits was appended to the PR... I'll try to fix it. Thanks.

Edit: Now feel free to merge it :D

For the later one, I don't think embedding these modules in the executable is a bad thing, as you has provided an option to switch it. At least for me it's a little weird when the compiling just passed and running the executable got a "file not found" (I have not read the readme in detail at that time).

What's more, I think this project is mostly for something like "experiment" (at least currently) so a standalone is not so "necessary", but once if I want to release a "product" as a brand-new language, for example, may be this feature could help, since a standalone REPL is needed, definitely.