Coder Social home page Coder Social logo

orzo's Introduction

Progress

Orzo

Orzo is a Java-based language for the JVM.

It's named after my beverage of choice while coding it.

Features

Orzo-only features (not available in Java)

Types

Operators

  • assignment =
  • parallel assignment
  • parallel declarations, e.g. int a,b,c,d,e,f = 1,2,3
  • repeat
  • arithmetic +, -, *, /, %
  • ** power operator , e.g. int b = a ** 5
  • sqrt operator , e.g. double x = √n + √(n+1)
  • parenthesis ( ,)
  • unary post/pre-increment and decrement ++, --
  • compound assignments +=, -=, *=, /=, %=, <<=, >>=, >>>=, &=, ^=, |=
  • relational <, <=, >=, >
  • equality ==, !=,
  • bit &, ^, |, <<, >>, >>>
  • unary minus -
  • casting () (partially supported)
  • object creation new (partially supported)
  • logical &&, ||
  • unary logical !
  • unary bitwise ~
  • unary plus +
  • instanceof
  • String and char concatenation +
  • ternary ?:

Control strcutures

Notes

  • array defintions must be of the form int[] a, int a[] is not supported
  • Orzo creates class files with major version 50 (Java 6). Newer versions would require implementation of the StackMapTable attribute.
  • fields and variables share the same namespace

Example

Calculating π using the Gauss-Legendre algorithm:

public double pi(int n) {
  double a, b, t, p, x = 1, 1/√2, 1/4, 1;
  repeat n
  {
    x, a, b  =  a, (a + b) / 2, √(x*b);
    t, p     =  t - p * ((x-a) ** 2), 2 * p;
  }
  return ((a+b) ** 2) / (4 * t);
}

More examples can be found here.

Build

with mvn

mvn package

with javac and jar

javac $(find ./src/main/java -name "*.java") -d bin && jar cfe orzo.jar io.github.martinschneider.orzo.Orzo -C bin .

Usage

java -jar target/orzo.jar inputFiles -d outputFolder

orzo's People

Contributors

martinschneider avatar

Stargazers

 avatar

Watchers

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