Extend uLisp by generating C source from Lisp definitions?


#1

Greetings, @johnsondavies!

I have again an idea… I know, ideas are cheap, but still:

“As is” I find it difficult to add any “own” function to ulisp’s source simply because I don’t feel very secure with C; you explained very well how this is done, but the issue remains — and perhaps exists for others, too.

Now, my question: would it be possible to create some tool that takes a file (of Lisp definitions) and generates out of it C-source? — That would make creating extensions rather easy.

(My underlying issue: we are starved of RAM, even in the most powerful boards, and save-image is even worse unless you use SD-card-support. I want to make a sort of chatbot, and chatbots need, essentially, a lot of text. If the text is immutable, it might be defined best within a ulisp source extension.)


#2

Hi Aeneas,

Thanks for your suggestion!

Now, my question: would it be possible to create some tool that takes a file (of Lisp definitions) and generates out of it C-source?

The short answer is: possible, but hard.

For your chatbots I think your best solution is to find a board with a lot of RAM memory, such as the Adafruit ItsyBitsy M4, which gives you 20480 Lisp cells. Although uLisp’s representation of strings isn’t very efficient, this will still give you enough memory to store 81920 characters.