Skip to content

A dynamic interpreted language inspired by Elixir, Lua, Python, Nim and Monkey.

License

Notifications You must be signed in to change notification settings

marteinn/Vaja-Lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Väja

Väja is a dynamic interpreted language inspired by Elixir, Lua, Python, Nim and Monkey.

Features:

  • First class/higher order functions
  • Pattern matching for functions
  • Closures
  • Integers, floats, strings, bools, regex
  • A repl
  • let statements
  • Arithmetic expressions
  • Pipe operator
  • Immutable data
  • Uses a tree walking, top to bottom, interpreter
  • A pratt parser
  • A (work in process) compiler and virtual machine

Example syntax

let myList = [1, 2, 3]
let myLongerList = myList ++ [4, 5, 6]
Array.map(fn (x) -> x*2, myLongerList)
let isTrue = if (2 > 1) true else false end
print(String.len("my string"))
1.1 |> type()
let trimAndCapitalize = capitalize << trim
trimAndCapitalize("   helllo world")

This is how you would spin up the built in web server

Http.createServer() \
|> Http.addHandler(fn (req)
  {
    "status": 200,
    "body": "{\"message\": \"Hello world\"}",
    "headers": [
      ["Content-Type", "application/json"],
    ]
  }
end) \
|> Http.listen(8080)

Compiling from source

  • First install nim
  • Compile vaja: nim --run c -o:bin/vaja src/vaja.nim

Running

Using the repl

./bin/vaja
Väja
>>> 1+1
2

Executing a file

./bin/vaja examples/hello.vaja
2

Language syntax

See the language specification

Editor integration

You can find a vim plugin here.

Like the Väja syntax?

Awesome, since Väja is a "hobby" language I recommend that you use Elixir, a great Lua/Ruby functional language built around the BEAM.

Väja?

The name comes from a lumber mill in the northen of Sweden.

Running tests

  • nimble test

Credits

References/links

License

This project is released under the MIT License.

About

A dynamic interpreted language inspired by Elixir, Lua, Python, Nim and Monkey.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages