1
1
Fork
You've already forked inter
0
No description
  • Gleam 95.3%
  • Vento 1.2%
  • Nix 1.1%
  • JavaScript 1.1%
  • Just 0.7%
  • Other 0.6%
2026年06月25日 01:05:26 +02:00
.github/workflows initial commit 2025年07月15日 02:46:49 +02:00
birdie_snapshots add support for module paths 2026年06月11日 02:45:51 +02:00
dev remove unused code 2026年06月25日 00:45:59 +02:00
mischief update examples 2026年06月11日 02:45:51 +02:00
src stop panicing on unknown command and add exit codes 2026年06月11日 02:45:51 +02:00
test change ast.Block to make return more explicit in structure 2026年06月11日 02:45:51 +02:00
website change case arrow to thin arrow 2026年01月23日 12:30:41 +01:00
.envrc add minimal flake 2026年06月25日 01:05:06 +02:00
.gitignore try out gleescript 2025年11月27日 03:48:51 +01:00
flake.lock add minimal flake 2026年06月25日 01:05:06 +02:00
flake.nix add minimal flake 2026年06月25日 01:05:06 +02:00
gleam.toml add gleamy_bench to benchmark lexer 2026年01月23日 12:30:41 +01:00
justfile make justfile commands more explicit 2026年06月25日 00:46:26 +02:00
manifest.toml update deps 2026年06月11日 02:45:51 +02:00
README.md add run instructions to README 2026年06月25日 01:05:26 +02:00

inter

A parser for a simple language.

fact = fn(n) begin
 case n of
 0 -> 1
 n -> n * fact(n - 1)
 end
end

You can find more examples of the language itself in the ./mischief/ directory.

Development

gleam run # to enter a REPL
gleam run -- help # see cli options
gleam test # Run the tests

Required dependencies

There is a flake.nix if you have nix + direnv setup.

Otherwise you'll need at least gleam + erlang (or a JavaScript runtime) installed.

If you want to try the bare bones scheme backend you'll also need chicken-scheme.

Design

Passes

Lex↓Parse↓ModuleResolution// TODO: can this happen after lowering to ANF?↓TypeCheck↓ANF↓Backend

Uniform Function Call Syntax

"hello".print()
"hello".(fn(s) s.split("e"))()

transforms into

print("hello")
(fn(s) split(s, "e"))("hello")

grammar

Lexical grammar can be seen in the lexer.

TODO: Terminals

IDENTIFIER: Lower case name e.g. hello, sqrt, hello_world

module = { statement } ;
statement = assignment | expression ;
assignment = IDENTIFIER [ ":" type ] "=" expression ;
expression = NUMBER | BOOLEAN | TODO