f414175e0c | 7 years ago | |
---|---|---|
old | 7 years ago | |
.gitignore | 7 years ago | |
Makefile | 7 years ago | |
README.md | 7 years ago | |
builtins.c | 7 years ago | |
builtins.h | 7 years ago | |
memory.h | 7 years ago | |
ops.c | 7 years ago | |
ops.h | 7 years ago | |
parser.c | 7 years ago | |
parser.h | 7 years ago | |
script | 7 years ago | |
shell.c | 7 years ago | |
shelpers.c | 7 years ago | |
shelpers.h | 7 years ago | |
stack.c | 7 years ago | |
stack.h | 7 years ago | |
stdlib.c | 7 years ago | |
stdlib.h | 7 years ago | |
variable.c | 7 years ago | |
variable.h | 7 years ago |
README.md
interpreter
This project aims to provide a very minimal scripting language for embedded systems. Many other languages already exist, such as Lua, Tcl, or BASIC; however, most implementations require certain system calls like a read() and write(), as they expect a filesystem. This interpreter aims to be as independent and portable as possible: parsing script from strings one at a time, having minimal built-in functions (so the user can define their own prints and such), and only requiring a few standard library functions.
To use this program with your own device, you need some malloc/free implementation, and string functions like those in string.h, atoi, and snprintf. Some of these functions may become coded in so that a standard library isn't required.
Only a few commands are built in to the interpreter:
- set - set variables
- func/end - define functions
- if/end - if conditional
- do/while
- ret - return value from function
Other features:
- function/variable defining in c
- expression solving
- no local variables
- whitespace hopefully ignored
Soon:
- error messages
- arrays?
- maybe for loops
This project is still in heavy development, so don't expect much. To include it in your own project, just link in parser.o and use the header files.