Väja is a dynamic interpreted language inspired by Elixir, Lua, Python, Nim and Monkey.
- 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
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)
- First install nim
- Compile vaja:
nim --run c -o:bin/vaja src/vaja.nim
./bin/vaja
Väja
>>> 1+1
2
./bin/vaja examples/hello.vaja
2
See the language specification
You can find a vim plugin here.
Awesome, since Väja is a "hobby" language I recommend that you use Elixir, a great Lua/Ruby functional language built around the BEAM.
The name comes from a lumber mill in the northen of Sweden.
nimble test
- Thorsten Ball - Writing A Interpreter In Go
- Thorsten Ball - Writing A Compiler In Go
- Nim by Example
- unittest
- Nim for python programmers
- Docs / Unittest
- Let's Explore Object Oriented Programming with Nim
- Object variants
- A Scripter's Notes
- The Nim memory model
- Inside The Python Virtual Machine
- Let’s Build A Simple Interpreter
This project is released under the MIT License.