rxi / aria

A tiny, embeddable lisp-shaped language implemented in C89
MIT License
167 stars 18 forks source link

LOW PRIORITY Enhancement Request: Allow explicit garbage collection #6

Closed jason-c-daniels closed 7 years ago

jason-c-daniels commented 7 years ago

This is low priority, but I thought I'd toss it out there.

I tinker with microcontrollers. Lately I've been using aria on a NUCLEOF411RE. It has a whopping 96K of RAM (this is actually large for microcontrollers). I foresee needing to explicitly do garbage collection, in some aria programs, in order to keep enough RAM free to stay operational.

rxi commented 7 years ago

I'm surprised to hear aria runs in any capacity on a microcontroller; this was never really one if its goals, for example, little thought was put into trying to assure minimal memory usage. Assuming you do have any success with getting something useful to run on the microcontroller I would be interested in hearing about your results.

If you do run into problems regarding memory I suggest searching for a language which is intentionally written from the ground up to run on a microcontroller -- this not being one of aria's goals means it would take a substantial amount of effort to tailor it for such a platform.

The ar_gc() function is exposed, and can be safely wrapped into an ar_CFunc and called from within a script if you want. Due to trying to keep the number of in-built functions down and aria not being built to target micro controllers I'm resistant to the idea of adding this into aria itself.

jason-c-daniels commented 7 years ago

First off, thanks for your quick replies and the the heads up on the goal of aria. I'll just implement that myself and register it as I've done so far with other functions.

For example, I'm having to reimplement some stuff from lib.lsp as native C/C++ because loading lib.lsp causes the microcontroller to lockup (runs out of memory). Plus I've patched through some TFT display rudiments. (circle, line, text out, rectangle...etc.)

For a final note: I was also surprised it runs on a microcontroller. But, the goal of this effort is to abuse the microcontroller and make it load and execute scripts of some sort off of a microSD card. Functionally, making it behave more like a regular computer versus microcontroller, albeit quite constrained. Since it does work, I want to see how far I can push that envelope with this little language since it's shown the most promise for the least effort on my part.

So far so good with running the pared down version of aria on my NUCLEO (i.e. sans loading lib.lsp). When I get further along, I'll publish the project and the aria specific library, complete with whatever changes you accept from my upcoming pull requests. The plan so far is to expose interactions with MBED objects, pins...etc. through Aria.

If you'd like i can shoot you the link once its published. It's easy enough to view the code online once signed up for MBED.