Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ippan/clover

a scripting language created in Rust~
https://github.com/ippan/clover

clover language rust rust-lang script scripting-language

Last synced: about 2 months ago
JSON representation

a scripting language created in Rust~

Awesome Lists containing this project

README

        

# Clover

| clover | clover-std | clover-cli |
| ----------- | ------- | ----------- |
| [![crates.io](https://img.shields.io/crates/v/clover.svg)](https://crates.io/crates/clover) | [![crates.io](https://img.shields.io/crates/v/clover-std.svg)](https://crates.io/crates/clover-std) | [![crates.io](https://img.shields.io/crates/v/clover-cli.svg)](https://crates.io/crates/clover-cli) |

[![CI](https://github.com/ippan/clover/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/ippan/clover/actions/workflows/build_and_test.yml)
![Crates.io](https://img.shields.io/crates/l/clover)

a scripting language created in Rust

still in development~

## Features
* bytecode
* first class function
* error handling

## Example

You can go to [examples](https://github.com/ippan/clover/tree/master/examples) directory for more examples

### Hello World

```ruby
function main()
print("hello world!")
end
```

### Include other file

rectangle.luck
```ruby
public model Rectangle
width
height
end

implement Rectangle
function area(this)
this.width * this.height
end
end
```

main.luck
```ruby
include Rectangle from "./rectangle.luck"

function main()
local rect = Rectangle(20, 30)
print(rect.area())
end
```

## Editor support

### Visual Studio Code

Use [Clover VSCode Support](https://github.com/ippan/vscode-clover) for code highlighting in [Visual Studio Code](https://code.visualstudio.com/)

## Integrate to your project

### Example

```rust
let result = create_state_by_filename("example/main.luck");

match result {
Ok(mut state) => {
state.execute();
}
}
```

### Export native function/struct to Clover

see [clover-std](https://github.com/ippan/clover/tree/master/crates/clover-std)

## CLI

### Install

use [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) to install the clover-cli

```shell
cargo install clover-cli
```

### Usage

```shell
clover examples/main.luck
```