Kleidukos / boreal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boreal

Syntax

The syntax is Haskell-like.

module Expressions where

type MyBool = MyTrue | MyFalse

expr x = x * 2 + 3

fun =
  let x = 3
   in x + 1

and its most advanced backend produces Lua code:

-- Expressions
local prelude = dofile("/home/hecate/Code/boreal/build_/libs/Stdlib/Prelude.lua")

-- Sum types are created as tables with keys
local MyBool = {MyTrue = {}, MyFalse = {}}
local function expr(x)
    local prim_mul0 = x * 2
    return prim_mul0 + 3
end
local function fun()
    local x = 3
    return x + 1
end
-- Functions are then collected to produce an export list in the form of…
-- a table.
local Expressions = {fun = fun, expr = expr, MyBool = MyBool}

-- Importing this module within Lua makes the export list available
return Expressions

CLI

A rudimentary CLI is available.

$ cabal run boreal -- build tree-sitter-boreal/datatype-declaration.bor
$ cat build_/libs/Expressions.lua
-- Expressions
prelude = require("./build_/libs/Stdlib/prelude")

local Optimisation = {O1 = {},
                      O2 = {}}

Development

Consult the development wiki for more information

About

License:Other


Languages

Language:Haskell 67.1%Language:C 27.9%Language:Rust 1.5%Language:JavaScript 1.5%Language:Lua 0.5%Language:Makefile 0.5%Language:C++ 0.4%Language:Assembly 0.4%Language:Python 0.2%Language:Scheme 0.0%