Skip to content

CrispOSS/jabsc

Repository files navigation

Build Status Coverage Maven Central Tag License

jabsc

jabsc is ABS compiler to Java source.

Usage

Maven Plugin

We have an example module to use Maven plugin for jabsc.

Java

To the use the compiler API:

Compiler compiler = new Compiler(sourceDirectory, outputDirectory);
compiler.compile();

and make sure you have the proper Maven dependency:

<dependency>
   <groupId>com.github.crisposs</groupId>
   <artifactId>jabsc</artifactId>
   <version>${version.jabsc}</version>
</dependency>

Tests

Please refer to jabsc-tests for a set of examples. In addition, the feature coverage of the compiler is testing using reference examples by Haskell compiler for ABS.

The legend for the following tables:

  • ✅ ABS source is compiled to Java and its test passes.
  • ❌ ABS source is compiled to Java but its test fails.
  • ❗ ABS source is compiled to Java but its test hangs.
  • ‼️ ABS source fails to compile to correct Java.

Tests: compiler/must/

Test State Comment
Arith
AsyncToSameCOG
AwaitOnThis
AwaitOnThis2
BenchLists
BenchMaps
CatchClauseBugInOtherBackends ‼️ Unreachable code is generated.
ClassDisjointInterfs
Cosimo1
Cosimo2 Object's field reference to a "future" is changed; thus the future is lost.
Cosimo3 Same as Cosimo2
Cosimo4
CosimoAsyncRun
Equality
ExceptionCase
ExceptionMod ‼️ Local variable is not final. Structural pattern matching on exceptions not supported.
ExceptionPos ‼️ Unreachable code is generated.
Fail1
Fail2
FieldToFunc
FixBugMonadicStyle
ForeignImport
Futures
HiddenMethod
Inference ‼️
InferenceNum ‼️
Interfaces
LeaderElection
Module Multi-module in the same file not supported.
MultipleTasksPerObject
MultiScope
NonMethods
Null ‼️ Usage of Java keywords such as null.
Parens
PingPong
PromiseSimple No definitive semantics.
PureCode
RunAndNonMethods
StatefulOO
Subtyping
Subtyping2
TestAwait
TestMaps
TestRefs
TestThis
ThisSwitching
TypeSym Parametric/Algebraic types not supported.
UpcastingInt Type information not available during compilation.
While

Benchmarks

We use [abs-bench][4] repository to perform benchmarks on generated Java code from jabsc. To run the benchmarks:

  • Checkout abs-bench and switch to "jabsc" branch
$ git clone https://github.com/abstools/abs-bench.git
$ cd abs-bench
abs-bench$ git checkout jabsc
  • Run the benchmarks from jabsc root source directory
$ cd /path/to/jabsc
jabsc$ ./jabsc benchmark /path/to/abs-bench/synthetic_par/
  • The results in CSV format and a GNU Plot result will be generated in /tmp.

The latest run of the benchmarks:

jabsc Benchmarks

Build Parser/Lexer

You need the following only if you modify src/main/resources/ABS.cf to generate the Lexer and Parser:

  1. Ensure you have bnfc tool on your PATH
  2. Run clean.sh
  3. Run build.sh
  4. The build should pass