Skip to content

hayleigh-dot-dev/gleam-yak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yak

Package Version Hex Docs

A small embeddable scripting language for Gleam.

❗️ This package is written in pure Gleam so you can use it whether you're targetting Erlang or JavaScript.

Quick start

import yak
import yak/expr
import yak/pkg/core

pub fn main () {
    let script = [
        expr.let_("greeting", expr.string("Hello, world!")),
        expr.call(ast.var("core::print"), [expr.var("greeting")])
    ]

    yak.run(script, core.env())
    // => "Hello, world!"
}

Installation

If available on Hex this package can be added to your Gleam project:

gleam add yak

and its documentation can be found at https://hexdocs.pm/yak.

FAQ

Why is it called yak?

Gleam's mascot is a star named Lucy. Originally I was going to call the language lucy, but that seemed a bit too on the nose. Lucy & Yak are a clothing brand popular within queer circles and Gleam is gay as heck so it seemed appropriate. 🏳️‍🌈

What is the syntax / how do I write yak?

Right now, this package does not come with a parser or make any assertions on what syntax might be appropriate: this is by design! Yak is supposed to be a minimal embeddable scripting language for your Gleam programs, but how that yak code is produced is up to you.

Maybe you want to provide more powerful configuration options to users of your Web app, or maybe you utilise Gleam's type safety in some circumstances but throw together quick scripts in others? How yak might look or be written might change drastically depending on circumstance – I hope the community can help make some packages for the most common use cases!

How can I contribute?

Despite what I just said above, it would still be useful to have a simple reference parser included in the package for people more interested in playing around or getting something working quickly.

You could also help expand yak's package ecosystem, either by adding to the core packages provided with yak, or publishing your own to hex as bindings to other useful BEAM libraries.

About

A small embeddable scripting language for Gleam.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages