Git Product home page Git Product logo

sarad's Introduction

sarad

Write a program only by a simple click

Demo

Left click to generate a code and right click to erase a code.

screenshot

How it works

Sarad is a word salad friendly programming language. Its interpreter never output any error for any generated program. Sarad code can be automatically generated by an LSTM model with RecurrentJS.

  1. Select input sentences for training from processing sample codes.
int whichBar = mouseX / barWidth;
if (whichBar != lastBar) {
  int barX = whichBar * barWidth;
  fill(barX, 100, mouseY);
  rect(barX, 0, barWidth, height);
  lastBar = whichBar;
}
  1. Convert them to sarad codes with the pde2sarad. Digits('0'-'9') are converted to 'D' and general variable names are changed to 'V0'-'V4'.
=V0 / mouseX V1
if != V0 V2
  =V3 * V0 V1
  fill/3 V3 DDD mouseY
  rect/4 V3 0 V1 height
  =V2 V0

Sarad is also a stack-oriented programming language written in a polish notation.

  1. The model is trained with the sarad-learner.

  2. Generate a code with the tained LSTM model.

if V0
  stroke/1 DDD
else
  stroke/1 0
line/4 - mouseX DD mouseX + mouseX DD mouseY
D DDD 0
vertex/3 - width DD - mouseY 1 0
  1. Assign digits to 'D', convert the operator into infix notation and eliminate dead code.
if(V0)
  stroke(656)
else
  stroke(0)
line((mouseX - 51), mouseX, (mouseX + 75), mouseY)
vertex((width - 16), (mouseY - 1), 0)

Acknowledgement

Libraries

RecurrentJS / p5.js / lz-string / lodash

License

MIT

sarad's People

Contributors

abagames 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.