AiScript Parser and interpreter for Dart

AiScript for Dart

AiScript parser and interpreter for Dart. Based on the reference implementation (syuilo/aiscript). This library has a very similar API to the original.

AiScript is a lightweight scripting language that was designed to run on top of JavaScript. For more information, check out the original repo's Getting started guide (en)

This package also contains a command line REPL program in bin/repl.dart

Implementation details

  • Core:v will correspond to the latest AiScript version that this is compatible with (not the library's actual version).
  • Mostly acts the same as the original implementation. If you find any differences, please report it as a bug (unless explicitly specified below).
  • Similar to the original, the API of this library is still unstable. Please be careful when upgrading to a new minor version (e.g. 0.1.0 -> 0.2.0) as breaking API changes might be present.

Non-standard behaviors

  • Out of range array assignments are allowed for now. Empty spots will be filled with null values.
  • Null safety: All functions must return a Value object. If a function doesn't need to return a value, it must still return a NullValue object.
  • Number values are passed to functions as a copy. Other types of values are marked as final and cannot be changed once initialized.
  • Async functions (timeout, interval) will not run the timers on their own due to how Dart works. You must await for Interpreter.runTimers() after Interpreter.exec() has finished so that the timers would run.

API reference

View on pub.dev

Examples

See /example

License

MIT

This project's test suite contains code from syuilo/aiscript which also uses the same license.

Use this package as a library

Depend on it

Run this command:

With Dart:

 $ dart pub add aiscript

With Flutter:

 $ flutter pub add aiscript

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  aiscript: ^0.3.0

Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:aiscript/aiscript.dart'; 

example/README.md

Examples

This directory contains examples on how to use the library.

  • hello_world.dart - How to parse a script and run it.
  • custom_vars.dart - How to create custom variables and initialize the interpreter state with them. 

 

Download details:

Author: LeadRDRK

Source: https://github.com/LeadRDRK/aiscript-dart

#dart #Script

AiScript Parser and interpreter for Dart
1.05 GEEK