diff --git a/README.md b/README.md new file mode 100644 index 0000000..ab1c708 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# Calculon : My try to build a library Distributable with Luarocks using Teal + +![Calculon](doc/Calculon.webp "Calculon") + +# Logbook + +## e18f54c977 init + +Init a teal project with `cyan init`, then write the `calculon.tl` lua. + +Note : I also added `.gitignore` and `.gitkeep` files to not commit generated +files from `cyan build`. + +## d24e69a41e add(consumer) init + +Add a Lua consumer script to try the calculon lib. It can be run with + +```sh +lua consumer.lua +``` + +Notes : + +* We need to first build the lib with `cyan build` +* The consumer needs to require calculon from the build directory + +## a433eb2fe4 add(luarocks) init + +Init a Luarocks module in the current directory. + +I need to add the module `calculon = "build/calculon/init.lua"` to make the +rock not empty. + +## b4d00c05ae add(build) force commit lua + +Because the rock needs the generated lua, I force commit it :'( + +## acb833e8e1 add(consumer) load calculon as module + +The consumer can now load calculon as a "normal" module! + +## 5eb06ccafb chore(consumer) move it to a project + +Move the consumer to its own project with Luarocks. + +Notes : We need to install calculon manually from the rockspec with +`./luarocks install ../calculon-0.1-1.rockspec` + +## dac8260ea9 add(consumer) teal + +Move the consumer to teal! + +It can be build with `tl build`. Then run with `./lua build/consumer.lua`. + +Note : + +* To prevent the missing types definition error, I need to use the trick from tabular module +* We can't run the teal file directly `tl run src/consumer.tl` :'( + +# TODO + +* The consumer works only because the generated file can "find" the module thanks to `./lua` +* Distribute teal files in the rock + +# References + +* https://github.com/teal-language/tl/blob/master/docs/tutorial.md +* https://github.com/teal-language/cyan +* https://github.com/teal-language/teal-types +* https://github.com/hishamhm/tabular + +Image from https://futurama.fandom.com/wiki/Calculon \ No newline at end of file diff --git a/doc/Calculon.webp b/doc/Calculon.webp new file mode 100644 index 0000000..1847f32 Binary files /dev/null and b/doc/Calculon.webp differ