Code Monkey home page Code Monkey logo

alfa's Introduction

ALFA

A domain specific language for animations

Types

int

Represents an integer accordingly to the JavaScript definition.

rect

Represents a rectangle.

bool

Represents truthy or falsy values.

Built-in functions

move(rect x, int offsetX, int offsetY, int duration)

Moves a rectangle from its current position to a new position based on offsetX, and offsetY over a duration in miliseconds.

Parameters Description
rect x A declared variable of type rect
int offsetX A declared variable of type int
int offsetY A declared variable of type int
int duration A declared variable of type int that must be positive

wait(int duration)

Repeats the last played frame over a duration in miliseconds.

Parameters Description
int duration A declared variable of type int that must be positive

createRect(int xPosition, int yPosition, int width, int length)

Creates a rectangle at (x, y) on the canvas with a given width and length.

Parameters Description
int xPosition A declared variable of type int
int yPosition A declared variable of type int
int width A declared variable of type int
int length A declared variable of type int

Keywords

paral { }

Used to play animations in parallel. Currently, only the move built-in function is allowed to be executed within a paral statement. Note, only allows the same property in a single paral to be changed once.

loop (int i from 1 .. 2) { }

Allows animations to be played a number of times. The loop above is executed twice, where i is first assigned to 1, then 2.

if(bool condition1)-else if(bool condition2)-else

The typical if statement.

Single Line Comments

Initiated by '#'

alfa's People

Contributors

asbjoernjc avatar jonasglund99 avatar fredthenoob avatar blakroenne avatar korfitz1dev avatar

Stargazers

nomanker avatar  avatar  avatar frihauge avatar

Watchers

 avatar

alfa's Issues

Visitors ALFA 2.0

  • Add the misssing visitors and nodes
  • Handle 'constant folding' in type checker - expressions have to be evaluated to for instance an int when used in a int declaration.

Codegen MVP

  • variable output
  • setup() output
  • draw() output
  • output
  • remove dictionary: rename x0 -> x_myrect1 (introduce classes)

p5.js for 2.0

  • Få paral til at fungere
  • Kør på y aksen
  • Lav simpelt eksempel (v2ExampleProgram.txt)
  • Tilføj loops
  • Tilføj ifs
  • Måske tilføj expressions

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.