Skip to content

Create generator.yml #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/templates/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "rock"
version = "{version}"
authors = ["champii <contact@champii>"]
edition = "2018"

[dependencies]
clap = "2.32.0"
lazy_static = "1.2.0"
regex = "1"
env_logger = "0.5.12"
log = "0.4"
bitflags = "1.2.1"
concat-idents = "1.1.2"
# inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm11-0"] }
inkwell = { version = "0.1.0-beta.3", features = ["llvm12-0"] }
either = "1.5"
serde = "*"
serde_derive = '*'
bincode = "*"
colored = "2.0.0"
paste = "1.0.5"

[lib]
name = "rock"
path = "src/lib/rock.rs"

[[bin]]
name = "rock"
path = "src/bin/main.rs"
103 changes: 103 additions & 0 deletions .github/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Rock {version}

[![Rust](https://github.com/Champii/Rock/actions/workflows/rust.yml/badge.svg?branch={branch})](https://github.com/Champii/Rock/actions/workflows/rust.yml)

Little toy language made with Rust and LLVM.
Aim to follow the Rust model with enforced safeness with a borrow checker and native performances thanks to LLVM.
It's highly inspired from Livescript, and will borrow (pun intended) some features and syntaxes from Crystal, from functional languages like Haskell, or even from Rust itself.

# VTable
- [Features]( #features )
- [Development notes]( #development-notes )
- [Install]( #install )
- [Using released binary]( #using-released-binary )
- [With cargo from Git]( #with-cargo-from-git )
- [From sources]( #from-sources )
- [Quickstart]( #quickstart )

## Features

- Strongly typed
- Type inference
- Custom operators
- Typeclass (Traits)
- Parametric Polymorphism by default
- Compile to LLVM IR

## Development notes

This project, its syntax and its APIs are subject to change at any moment.
This is a personal project, so please bear with me
(Differently put: this is a big red hot pile of experimental garbage right now)

## Install

How to install and run the compiler:

### Using released binary

[Rock {version}](https://github.com/Champii/Rock/releases/download/{version}}/rock) (Tested on arch linux)

``` sh
wget https://github.com/Champii/Rock/releases/download/{version}/rock
chmod +x rock
./rock -V
```

### With cargo from git

``` sh
cargo install --git https://github.com/Champii/Rock
rock -V
```

### From sources

``` sh
git clone https://github.com/Champii/Rock.git
cd Rock
cargo run -- -V
```

## Quickstart

Lets create a new project folder to compute some factorials

``` sh
mkdir -P factorial/src && cd factorial
```

Add some files like this:

- Copy the std lib files from [std](https://github.com/Champii/Rock/blob/master/std/src) into `./src/`

- Create a `./src/main.rk` file:

```haskell
mod lib

use lib::prelude::*

# Polymophic function
id a = a

fact a =
if a <= 1
then 1
else a * fact (a - 1)

main = print fact id 4
```

Assuming that you built Rock and put its binary in your PATH:

``` sh
rock run
```

Should output

``` sh
24
```

8 changes: 8 additions & 0 deletions .github/templates/replacer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

cp ./.github/templates/README.md .
sed "s/{version}/${NEW_VERSION}/g" README.md

cp ./.github/templates/Cargo.toml .
sed "s/{version}/${NEW_VERSION}/g" Cargo.toml
1 change: 1 addition & 0 deletions .github/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.1.4
17 changes: 17 additions & 0 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Generator

on:
create

jobs:
replace:
runs-on: ubuntu-latest
name: Generate Readme.
env:
VERSION: $(cat .github/version)
NEW_VERSION: $VERSION-$GITHUB_REF

steps:
- uses: actions/checkout@v2
- name: Generate replacers
run: ./.github/templates/replacer.sh