flight_script 0.1.1 flight_script: ^0.1.1 copied to clipboard
A small flutter compatible embeded scripting language. Because sometimes you just need some scripting..
A small scripting language to embed in your flutter projects.
Features #
- Lightweight scripting. Define functions. create loops. Assign variables. All the usuals.
- Call dart functions from flight, or call flight from dart.
- Interpreter can dynamically adapt while running
- VM is separate from the parser, for added extensibility
Getting started #
Initializing the interpreter and running a script:
import 'package:flight_script/flight_script.dart';
void main() {
final interpreter = Interpreter();
interpreter.eval('"The answer to the ultimate question is " << 42 print');
}
Result
[Hello, World!]
Notice that returned values are returned in an array, as multiple returns are allowed
Advanced example #
A stack based, recursive, factorial function
{
dup > 1
<{ dup - 1 ! _* }>
<{ }>
if
} -> !
5 ! print
More examples in the examples/
folder.