waran
v1.2.9
Published
a compiled programming language
Readme
waran
about the project
credits
example waran program
import @io
import @math
class Program {
method static main() {
hello := "hello"
waran := "waran!"
std_out(hello waran)
for(i := 0 | i <= 10 | i++) {
## skip the 5th iteration
if (i == 5) {
continue
}
std_out(i)
}
while(true) {
if (counter > 10) {
break
}
std_out(counter)
counter++
}
my_array := ["string value" 4738 -21.564 true]
std_out(my_array[2])
}
}
Program.main()table of contents
Installation
npm i -g waranor
yarn add -g waranProject structure
wrn initthis command will create a few folders / files:
- .waran folder
- ast
- build
- ast
- wrn_proj.json
- describes the behaviour of the compiler.
- project_info - contains general information about the waran project
- dirs - contains paths to directories used by the compiler
- ast_dir
- location of abstract syntax tree (ast) files
- wrn_proj_dir
- location of the .waran directory (contains asts and build)
- src_dir
- location of the working direcotry (contains your source code)
- build
- location of the directory that contains built waran code
- ast_dir
- describes the behaviour of the compiler.
- src folder
- current working directory
- location can be modified in wrn_proj.json configuration file
- current working directory
Compiling code
wrn compile < .wr file location >this will produce a .js counterpart in the .waran/build directory unless the behaviour was modified in wrn_proj.json
Running code
wrn exec < path to .js file >.js files can be found in the .waran/build directory with the same name as their .wr counterparts
