A Gleam codegen library in Gleam
Gleam 87.9%
Nix 5.1%
Shell 3.0%
Other 4.0%
6 1 0

Clone this repository

https://tangled.org/lesbian.skin/stare
git@tangled.org:lesbian.skin/stare

For self-hosted knots, clone URLs may differ based on your setup.

README.md

stare#

Package Version Hex Docs

gleam add stare@1
import gleam/io
import stare
import stare/function
import stare/value
import stare/type_
import stare/import_

pub fn main() -> Nil {
  let assert Ok(code) = stare.module(
    imports: [
      import_.import_(
        module: ["gleam", "io"],
        types: [],
        constructors: [],
        functions: [],
        alias: None,
      ),
    ],
    functions: [
      function.function(
        name: "main",
        public: True,
        parameters: [],
        return_type: Some(type_.nil),
        statements: [
          function.call(
            module: Some("io"),
            function: "println",
            arguments: [stare.value(value.string("Hello World!"))],
          ),
        ],
      ),
    ],
  )
  io.println(code)
  // import gleam/io
  // 
  // pub fn main() -> Nil {
  //  io.println("Hello World!")
  //}
}

Further documentation can be found at https://hexdocs.pm/stare.

Development#

gleam run -m birdie   # Run birdie
gleam test            # Run the tests

Nix#

nix run .#birdie   # Run birdie
nix run .#test     # Run the tests