waran

1.2.9 • Public • Published

waran

about the project

Waran is a compiled language with it's target being javascript. The waran compiler is implemented in typescript and required node.js to run.

credits

made by kamkow1
special thanks to londek for helping out ;)

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

  1. Installation
  2. Project structure
  3. Compiling code
  4. Running code

Installation

in order to install the waran compiler run:

npm i -g waran

or

yarn add -g waran

Project structure

to initalize an empty waran project, run:

wrn init

this command will create a few folders / files:

  1. .waran folder
    • ast
      • this folder contains the .ast files for the compiler.
        in general you don't want to edit any files there.

    • build
      • this folder contains compiled files (.wr -> .js).

  2. 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
  3. src folder
    • current working directory
      • location can be modified in wrn_proj.json configuration file

Compiling code

to compile waran code run:

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

to run waran code use:

wrn exec < path to .js file >

.js files can be found in the .waran/build directory with the same name as their .wr counterparts

Readme

Keywords

none

Package Sidebar

Install

npm i waran

Weekly Downloads

0

Version

1.2.9

License

ISC

Unpacked Size

106 kB

Total Files

18

Last publish

Collaborators

  • londek
  • kamkow1