[ANN] loo - lua of ocaml

Hi
Like mentioned in the title this compiles Ocaml (Bytecode) into Lua (lua5.1). This project is ai generated, I tried to fully disclose that with the methods described in the project ocaml-ai-dislosure:

1 Like

Is the comical value of the name intentional or accidental? Especially when this has been developed with AI.

1 Like

The name was my contribution. I wanted to make sure I still had the last word somewhere in the repo.

2 Likes

This reminded me of Parsing Lua in Lua with OCaml | SquidDev, which takes a more ā€˜manual’ approach (basically hand-translating the tables that Menhir produces into lua tables)

2 Likes

This doesn’t work for me with a plain Lua 5.1 interpreter:

# In PowerShell but hopefully should work in a Unix shell
$ git -C build clone https://github.com/maltasea/lua_of_ocaml.git
$ docker run -v $PWD/build/lua_of_ocaml:/work --workdir /work -it nickblah/lua:5.1-luarocks bash

/work# lua -v
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio

/work# lua test/hello.lua
lua: test/hello.lua:2873: 'end' expected (to close 'if' at line 2871) near '_v473'

What interpreter are you using?

1 Like

thanks for trying it out. Claude and I solved a lot of errors and write new and better tests. It should now run with lua5.1.5 and luajit. If you want, please give it another shot by run make hello after cloning

[I] ~ % cd ~/temp
% git clone https://github.com/maltasea/lua_of_ocaml
Cloning into ā€˜lua_of_ocaml’…% cd lua_of_ocaml
[I] ~/temp/lua_of_ocaml % make hello
dune buildocamlc -g -o hello.byte hello.mldune exec – compiler/bin lua_of_ocaml/main.exe – hello.byte -o hello.lua
lua hello.lua
hello from lua

I was not expecting the code to be rewritten to get the hello world example to work. Sorry, but it sounds like you didn’t/can’t detect when LLMs hallucinate. Thanks; I won’t look at this further.

4 Likes

hmm, not sure what you mean, or why do make the halluzination not detected claim. there is quite some time between the first announcement and your report. At the beginning there where some problems with the generated lua. But this and numerous issues where detected by me and solved, among other the initial problem with some faulty lua, you where refering to. So up to this time i’ve manually done around 40 commits, and as far as i can tell all quite intentional :slight_smile: …

But admittedly, the whole experience is a bit strange and the ego is a little bruised, for sure. However after having poured something around 13 hours in it, I’m ok with the end result. While it cannot not match the quality of a skilled Ocaml developer, and while there are things there are bothering me more on a conceptual/structural level (ffi). It’s something I can use now.

And honestly when I think about it, the strange and ego-bruising experience is also due to the tools that absolutely suck. All this ā€œagenticā€ tools are so annoying to work with. Therefore parallel to loo, i’ve created a new tool called devpost , that works more like ai forum. The goal: using AI much more granular that this blunt and user hostile ai tools like ClaudeCode or Codex. While I find it fascinating how well this LLM tech works and the science behind, i hate to be plugging into this gigantic money eating ai corporations. So beeing able to use much smaller and locally run models would be taking alot of the distopian shadow away.