Alright, I managed to get something working with the matron REPL based on @csboling’s advice (thank you!).
Running into some issues now. For example, when trying to write a simple for loop the value that’s returned is nil (instead of printing n):
(for [n 1 5] (print n))
I believe this is happening because the fennel compiler turns that bit of code into this:
for n = 1, 5 do
print(n)
end
return nil -- <- The problem??
I’m not totally sure.
The second obstacle is the way I’m processing the code from Maiden. I wrote a little Lua script to compile the code:
#!/usr/bin/env lua [0/1893]
f = require("fennel")
local lua = f.compileString(arg[1])
print(lua)
And it’s called in C like so:
(pardon the horrendous code, I don’t really program in C. A lot of this was copied
)
int l_handle_line(lua_State *L, char *line) {
size_t l;
int status;
char *command = "/home/we/Fennel/compile_fennel_string.lua ";
char *str = (char *)malloc(sizeof(char)*(strlen(line) + strlen(command + 4)));
strcpy(str, command);
strcat(str, "\'");
strcat(str, line);
strcat(str, "\'");
FILE* f = popen(str, "r");
if (f == NULL) {
fprintf(stderr, "l_handle_line: Failed at parsing fennel.");
exit(1);
}
char *output = NULL;
size_t len = 0;
while (getline(&output, &len, f) != -1)
fputs(output, stdout);
...
}
The problem I’m running into is if I pass in something that contains ' then that’s going to break the compilation step because the string of Fennel code will be terminated prematurely. Example:
(print "it's not ok")
is basically like running this in bash:
./compile_fennel_string.lua '(print "it's not ok")'
Not an insurmountable problem, but it feels hacky that I have to deal with it.
Ok, collapsing the generated lua to a single line fixed the first problem 
