Diolor / PJ

PJ (stands for Pythonic Java) is a template language that resembles Python's indent grammar and compiles into Java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PJ

Full documentation is at pj.lorentzos.com.

PJ (stands for Pythonic Java) is a template language for Java that resembles Python's indent grammar and compiles into native Java. Inspired by Python and Jade.


The grammar is currently under development.

The aim is to create more a readable source code of Java. Ommiting braces can create 30% reduction in lines of the source code.

Syntax

PJ is a clean, whitespace sensitive syntax for writing Java. Here is a simple example:

Classic Java:

public class HelloWorld {

    public static void main(String[] args) {
        printHello();
    }
    
    private void printHello(){
        System.out.println("Hello, World");
    }
    
}

PJ:

public class HelloWorld

    public static void main(String[] args)
        printHello()
    
    private void printHello()
        System.out.println("Hello, World")

Installation

TODO: Download the latest version directly.

Or via gradle:

dependencies {
    compile 'com.lorentzos.pj:PJ:x.x.x'
}

Find the latest version at Gradle please

Use

To create a Java file from PJ simply:

$ java -jar PJ-0.1.0.jar <file> [-options]

Options include:

-c | -compile To generate .java files and compile them.

-cd To compile but not generate .java files.

-o: outputpath To specify the output path.

Development

The grammar is being designed with Antlr4. A visitor is used to emit the results from the parsed tree. The project can easily be imported with Gradle. TodoassembleCompiler task generates the latest Compiler jar

Also in plans there is Intellij Plugin from Syntax Highlightting and a probably a Gradle plugin to automate Compiler's job (+Android support).

License

MIT

About

PJ (stands for Pythonic Java) is a template language that resembles Python's indent grammar and compiles into Java.

License:MIT License


Languages

Language:Java 97.9%Language:ANTLR 1.7%Language:Groovy 0.2%Language:CSS 0.1%Language:Python 0.1%