mirror of https://github.com/rusefi/bldc.git
16307e5e9d
fb7d3503 added a llama 744ca079 Fixed an environment handling bug in conditionals b448596c small tweaks (warnings) git-subtree-dir: lispBM/lispBM git-subtree-split: fb7d35031649049a618cb1fc0c690edbfe45d7f6 |
||
---|---|---|
benchmarks | ||
chibios-examples | ||
doc | ||
docker | ||
examples | ||
include | ||
mascot | ||
notes | ||
old | ||
platform | ||
repl-cps | ||
src | ||
tests | ||
utils | ||
videos | ||
zephyr-examples | ||
.clang_complete | ||
.gitignore | ||
.travis.yml | ||
LICENSE | ||
Makefile | ||
README.md | ||
flash_nrf52_with_stlink.sh | ||
lispbm.mk | ||
runinfer.sh | ||
runsa.sh | ||
setup_fw_build.sh | ||
zephyr-source-me.sh |
README.md
lispBM (Lisp Black Magic)
A concurrent lisp-like language with message-passing and pattern-matching implemented in C for 32-bit platforms.
All programming languages need a mascot, so here is the LispBM llama by PixiLady.
Purpose
- Have fun.
- Learn about lisp.
- Learn about microcontrollers.
- An interactive REPL for devboards.
- ...
Features
- heap consisting of cons-cells with mark and sweep garbage collection.
- Built-in functions: cons, car, cdr, eval, list, +, -, >, <, = and more.
- Some special forms: Lambdas, closures, lets (letrecs), define and quote.
- 28-Bit signed/unsigned integers and boxed 32-Bit Float, 32-Bit signed/unsigned values.
- Arrays (in progress), string is an array.
- Compiles for, and runs on linux-x86 (builds 32bit library, runs on 32/64 bit).
- Compiles for, and runs on Zynq 7000.
- Compiles for, and runs on STM32f4.
- Compiles for, and runs on NRF52840.
- Compiles for, and runs on ESP32 (ARM - WROOM).
- Compiles for, and runs on ESP32C3 (RISC-V).
- Compiles for, and runs on Raspberry PI (Tested on 32bit Raspbian OS)
- Quasiquotation.
- Concurrency.
- Message-passing.
- Pattern-matching.
Documentation
Work in progress language reference and C code documentation can be found here.
LispBM's internals are documented as a series of blog posts.
There are demonstrations on YouTube.
Want to get involved and help out?
- Are you interested in microcontrollers and programming languages?
- You find it fun to mess around in C code with close to zero comments?
- Then join in the fun. Lots to do, so little time!
- Poke me by mail bo(dot)joel(dot)svensson(whirly-a)gmail(dot)com
TODOs
- Write some tests that stresses the Garbage collector.
- Implement some "reference to X type", for uint32, int32.
- Write a small library of useful hofs.
- Improve handling of arguments in eval-cps.
- Code improvements with simplicity, clarity and readability in mind.
- Implement a small dedicated lisp reader/parser to replace MPC. MPC eats way to much memory for small platforms.
- Port to STM32f4 - 128K ram platform (will need big changes). (surely there will be some more bugs)
- Add STM32f4 example code (repl implementation)
- Port to nrf52840_pca10056 - 256k ram platform (same changes as above).
- Reduce size of builtins.c and put platform specific built in functions elsewhere. (Builtins.c will be removed an replaced by fundamentals.c)
- Implement 'progn' facility.
- Remove the "gensym" functionality havent found a use for it so far and it only complicates things.
- Add NRF52 example repl to repository
- Update all example REPLs after adding quasiquotation
- The parser allocates heap memory, but there is no interfacing with the GC there.
- The parser uses a lot of stack memory, fix by making tail recursive and accumulating lists onto heap directly.
- Rename files with names that may conflict with common stuff (memory.h, memory.c).
- It should be possible to reset the runtime system.
- Add messages to lisp process mailbox from C to unlock blocked proc.
- Spawn closures specifically instead of expressions in general.
- Implement some looping structure for speed or just ease of use.
Vague or continuosly ongoing todos
- Doxygen?
- Tutorials?
- Be much more stringent on checking of error conditions etc.
- More built in arithmetic.
- More built in comparisons.
- Make uniform how to return success or failure. It is sometimes bool and sometimes int right now.
Compile for linux (Requires 32bit libraries. May need something like "multilib" on a 64bit linux)
-
Build the library:
make
-
Build the repl:
cd repl-cps
and thenmake
-
Run the repl:
./repl
Compile on Raspberry Pi
To build the library exeute the following command in the lispbm folder:
PLATFORM=pi make
To build the repl-cps
example repl do:
cd repl-cps
make pirepl
Then start it up using ./repl
Building the library is not a prerequisite for building the repl anymore.