https://github.com/picotools/plan
PLAN (Pico LANguage) - simple scripting language for embedding in Golang applications
https://github.com/picotools/plan
antlr4 golang language pico plan scripting-language
Last synced: about 1 year ago
JSON representation
PLAN (Pico LANguage) - simple scripting language for embedding in Golang applications
- Host: GitHub
- URL: https://github.com/picotools/plan
- Owner: PicoTools
- License: gpl-3.0
- Created: 2024-12-23T19:10:39.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-26T13:32:49.000Z (over 1 year ago)
- Last Synced: 2025-02-26T14:35:32.389Z (over 1 year ago)
- Topics: antlr4, golang, language, pico, plan, scripting-language
- Language: Go
- Homepage:
- Size: 1.99 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PLAN
PLAN (Pico LANguage) is a scripting language (interpreter-based) for embedding in Golang applications, based on ANTLR4 grammar.
## Why yet another scripting language?
The development of this language was part of the creation of a C2 framework — [Pico](https://github.com/PicoTools/pico), which we position as an interface between the operator and the beacon.
The PLAN runtime is used in the [operator's CLI](https://github.com/PicoTools/pico-cli) to extend the built-in functionality of interactions with the server and beacons.
Performance was not the primary goal of this language, but it can be easily achieved with display features written in native Golang.
## Syntax
PLAN syntax resembles `C` in structure (brackets and semicolons), while its typing system and execution logic are more similar to `Python`.
A `C`-like example (explicit brackets and semicolons):
```c
fn fib(n) {
if n < 2 {
return n;
} else {
return fib(n-2) + fib(n-1);
}
}
println(fib(35));
```
A `Python`-like example (dynamic typing of variable `a`):
```c
a = 1;
a = [a, 2, 3, 4];
a = {"test": a};
a = "hello";
a = a + " world";
println(a);
```
For more information and examples, see [syntax](docs/syntax.md).
## Data Types
All data types sit on top of an abstraction called object.
PLAN comes with the following data types, which implement the object interface:
- `bool` (bool in Golang)
- `dict` (map in Golang, where the key is a string)
- `float` (float64 in Golang)
- `int` (int64 in Golang)
- `list` (a list of objects)
- `null` (an empty object)
- `str` (a string in Golang, operating with runes)
- `closures` (a special type of object that can be called inline)
For more information and examples, see data [data types](docs/data_types.md).
## References
Here you can find additional information:
- [Syntax](docs/syntax.md)
- [Data types](docs/data_types.md)
- [Builtin functions](docs/builtin_functions.md)
- [Builtin methods](docs/builtin_methods.md)