1. 42
    1. 13

      Ahahahaha yes, does Fennel run on it?

      1. 8

        Not yet! It looks light right now it can parse almost all the way through to the end of the Fennel compiler, but it fails on the one use of long brackets in the file:

        ~/s/Fennel (main) [1]> racket fennel.lua
        fennel.lua:5187:25: expected expression but found [
           /Users/bogdan/sandbox/racket/racket/collects/syntax/readerr.rkt:15:2: -raise-read-error
           /Users/bogdan/sandbox/racket-lua/lua-lib/lang/parser.rkt:304:0: parse-expr
           /Users/bogdan/sandbox/racket-lua/lua-lib/lang/parser.rkt:293:0: parse-exprs
           /Users/bogdan/sandbox/racket/racket/collects/racket/match/compiler.rkt:548:40: f112
           /Users/bogdan/sandbox/racket-lua/lua-lib/lang/parser.rkt:78:0: parse-block
           /Users/bogdan/sandbox/racket-lua/lua-lib/lang/parser.rkt:99:0: parse-statement
           /Users/bogdan/sandbox/racket-lua/lua-lib/lang/parser.rkt:78:0: parse-block
           /Users/bogdan/sandbox/racket-lua/lua-lib/lang/parser.rkt:74:0: parse-chunk
           /Users/bogdan/sandbox/racket-lua/lua-lib/lang/reader.rkt:23:2: custom-read-syntax
           /Users/bogdan/sandbox/racket/racket/collects/syntax/module-reader.rkt:211:2: wrap-internal
           .../syntax/module-reader.rkt:76:9: wrap-internal/wrapper

        That should be pretty easy to fix. After that, I’m guessing it’ll fail because it relies on some of the missing stdlib things I mentioned in the post. I’ll try to spend some time in the next couple of weeks getting this to work though, since it would be pretty neat to be able to run Fennel from Racket.

        1. 7

          Aha, you found the one place in all of Fennel that uses Lua’s bracket-string syntax, for loading built-in macros. You could cut that part out and load a macroless variant of Fennel. =)

          Come by the #fennel channel on Libera if you need any more help! This does sound very interesting. Among niche Lua implementations the most common cause of incompatibilities are bugs from require/package and incompatibilities in string.find and other pattern functions. (I think one of the JVM ones just doesn’t even try and treats patterns exactly the same as Java patterns which obviously breaks a ton of things.)

      2. 3

        On the Racket discord the author mentioned something along the lines of ‘passed to antifennel and the result back through fennel.’ but you will have to ask the author on the Racket discord https://discord.gg/6Zq8sH5 or discourse https://racket.discourse.group/

        The repo for #lang lua is at https://github.com/Bogdanp/racket-lua

    2. 4

      More of this please. Let’s not keep stuffing everything via the C FFI

      1. 0

        I’m not the author. The best place is https://racket.discourse.group/