Skip to content

jayphelps/jayscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JayScript

Install

npm install jayscript -g

Usage

Currently JayScript only supports function declarations that take no arguments and can only have return statements. The return statement must return either an integer, or a binary expression of addition.

example.js
function main() {
  return 1 + 2;
}
jayscript example.js

    (module
     (type $none_=>_i32 (func (result i32)))
     (export "main" (func $0))
     (func $0 (result i32)
      (return
       (i32.add
        (i32.const 1)
        (i32.const 2)
       )
      )
     )
    )

Options

If you want to optimize the Wasm output, you can pass the -Oz flag:

jayscript example.js -Oz

    (module
     (type $none_=>_i32 (func (result i32)))
     (export "main" (func $0))
     (func $0 (result i32)
      (i32.const 3)
     )
    )

Notes

This is just a joke. :shipit:

About

A very small subset dialect of JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published