interpreter/README.md

25 lines
1.3 KiB
Markdown
Raw Normal View History

2018-01-23 08:17:07 -05:00
# interpreter
2018-02-05 11:49:40 -05:00
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.
2018-01-23 08:17:07 -05:00
2018-02-05 11:49:40 -05:00
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.
2018-01-23 08:17:07 -05:00
2018-02-05 11:49:40 -05:00
Only a few commands are built in to the interpreter:
* set - set variables
* func/end - define functions
2018-02-07 09:26:36 -05:00
* if/end - if conditional
* do/while
* ret - return value from function
2018-02-05 11:49:40 -05:00
Other features:
2018-01-23 12:00:30 -05:00
* function/variable defining in c
2018-02-05 11:49:40 -05:00
* expression solving
2018-02-07 09:26:36 -05:00
* no local variables
* whitespace hopefully ignored
2018-02-05 11:49:40 -05:00
Soon:
* error messages
2018-02-07 09:26:36 -05:00
* arrays?
* maybe for loops
2018-01-23 12:00:30 -05:00
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.