Giter Club home page Giter Club logo

naskah's Introduction

Hi there ๐Ÿ‘‹

naskah's People

Contributors

athif23 avatar blazeu avatar drepram avatar galuhsahid avatar pveyes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

naskah's Issues

Guard identifier on compiled JS

Currently we can use any reserved word/token (such as var, if, etc) as identifier in naskah which won't be valid JS. The simplest thing we can do is add underscore before printing the identifier if it's a reserved word in JS

So that:

misal x = 3;
misal var = 2;

jika while benar {
} 

should be compiled to

var x = 3;
var _var = 2;

if (_while == true) {
}

Bug on newline between/after statements

Addition / removal of some newline causes different bug

Case 1: newline required at the end of statement

misal x = 2; // no newline

Output:

salah sintaks

Expected:

var x = 2;

Case 2: Newline between statements

misal x = 2;

misal y = 4;

Output:

var x = 2;

Expected:

var x = 2;
var y = 4;

Fix indentation on compiled JS

Currently we didn't track depth level when writing compiled JS code. The solution can be implemented by passing depth as 2nd function argument

fn print_literal(l: Literal, depth: u8) -> String {
  ...
}

Input:

jika x benar {
  menang();
}

Output:

if (x == true) {
menang();
}

Expected:

if (x == true) {
  menang();
}

renaming varaible to more KBBI- ish

according to KBBI, javascript const which is constant in english, mean "konstan(t)" in indonesian
also, because javascript "let" is more scoped var, what if we named let to be "variable" instead of using "misal"

Build time optimization

Currently typical demo build took ~5 mins. Maybe we can improve it by using

  • @actions/cache for target directory
  • fetch wasm-pack via cURL instead of cargo`

Semicolon bug inside block expression

Reproducible on example page

This should works

jika a benar {
  x = x + 1;
  menang();
}

Currently we have to omit semicolon

jika a benar {
  x = x + 1
  menang()
}

And even the output is wrong (notice the double semicolon on AssignmentExpression)

if (a == true) {
  x = x + 1;;
  menang();
}

Alpha release

TODO list before OSS

  • VariableDeclaration
  • Number literal (bug eof) misal x = 2;
  • String literal misal x = "abc";
  • Boolean literal misal y = benar;
  • Null literal misal y = kosong;
  • BinaryExpression 2 + 2;
  • Recursive BinaryExpression 1 - 2 + 5
  • Assignment to binary expression misal x = 2 + 3
  • BlockStatement { statement; }
  • IfStatement jika x == 2 { }
  • CallExpression tulis(y);
  • Special if conditional jika x kosong, jika x benar, jika x salah
  • If else statement jika x == 2 { } atau { }
  • recursive if else jika x == 2 { } atau jika x > 3 { }
  • LoopStatement ulang { statement; }
  • BreakStatement berhenti;
  • ContinueStatement lanjut;
  • AssignmentExpression x = x + 1
  • ExpressionStatement x;
  • Printer -> Naskah AST to JS code

GitHub Action CI

Now that now-rust is moved from official package (and have few issues) let's move build & deployment to GitHub action + GitHub pages

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.