https://github.com/glimmr-lang/piccodescript
A simple functional scripting language created in java
https://github.com/glimmr-lang/piccodescript
compiler functional functional-programming interpreter java jvm jvm-languages language script scripting-language
Last synced: 6 months ago
JSON representation
A simple functional scripting language created in java
- Host: GitHub
- URL: https://github.com/glimmr-lang/piccodescript
- Owner: Glimmr-Lang
- License: mit
- Created: 2025-05-23T08:31:36.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-06-16T15:01:54.000Z (6 months ago)
- Last Synced: 2025-06-16T16:20:37.563Z (6 months ago)
- Topics: compiler, functional, functional-programming, interpreter, java, jvm, jvm-languages, language, script, scripting-language
- Language: Java
- Homepage: https://picasso-releases.fly.dev/piccodescript/
- Size: 571 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PiccodeScript
> A simple interpreted, functional programming language.
## Why?
PiccodeScript started as a dsl for an image editor (Picasso Code) I was building, and overtime
I fell in love with the simple syntax and I wanted to make to its own project, possibly for
embedding in my java programs or for general scripting.
## Installation
>> TODO:
## Example
###### Hello World
```js
import std.io
function main() = IO.println("Hello, world")
main()
```
###### Factorial
```js
import std.io
function fact(x=1) =
when x {
is 0 -> 1
is 1 -> 1
else -> x * fact(x - 1)
}
```
## Embedding API
To use the language in your project simply add it your `pom.xml` file as a dependency:
```xml
jitpack.io
https://jitpack.io
com.github.Glimmr-Lang
PiccodeScript
Tag
```
and then add the following code to your solution:
```java
Compiler.compile("function zero() = 0")
```
If you want to get a list of AST nodes do this:
```java
Compiler.prepareGlobalScope();
List nodes = Compiler.parse(input);
// Then you can execute them or do what you want
for (var expr: nodes) {
expr.execute();
}
```
To add symbols to the current scope you can do the following:
```java
Context.top.putLocal("hello", new PiccodeString("Hello, world"));
Compiler.compile("hello + 20"); // concate hello, world and 20
```
## Inspired by
- Lua - The simplicity
- Rust - The flexibility
- SML - Functional programming concepts