Giter VIP home page Giter VIP logo

waran's Introduction

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

waran's People

Contributors

kamkow1 avatar londek avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.