JaRIKo is an interpreter for the RPG programming language. It runs on the JVM since it's written in Kotlin.
It is part of a bigger project named Sme.UP Open Architecture, by the italian software company Sme.UP.
Sme.UP Open Architecture aims to build a software platform for business applications (also mistakenly known as ERP systems) and it is the core of Sme.UP Data Platform.
JaRIKo can be used as a library: you push RPG code in, it is executed, you get the results out. And it works, as you can see in this animated gif of a simple on-the-fly online rpg-running application.
This application is running completely on Linux
- receives the RPG code via HTTP
- uses Jariko as a jar
- overwrites the DSPLY opcode, redirecting the output to the http-response. Pretty slick!
But, for an enterprise-grade application, there will be a runtime environment running both RPG and JVM languages, with the following architecture:
Once a request comes into the system, it's recognized as a "program" (a unit of execution) and redirected towards the right program handler: RPG is handled by JaRIKo (interpreter), the others by different executors. So JaRIKo is one (important) part of the whole architecture
Why build something that executes RPG, such an old and niche programming language? RPG is widely used in the business enterprise and financial industry to this day. Big companies still rely on stable, battle-tested, mission critical RPG codebases to run their business.
This is for at least a couple of reasons.
First, RPG was designed for enterprise, it is very simple, powerful for data manipulation, but extremely inadequate at solving technology issues (like threads, async, http calls, cryptography, and so forth). The developer doesn't need to be aware of the technical details. The system provides all this technology, making code run on top of a platform that solves those issues.
This helped to create a generation of RPG programmers that are closer to business consultants than to developers, and this is very good for business applications development.
The second is that RPG only runs on IBMi, best known as AS/400, that was also designed for business, is very reliable, fast, well-supported, and stable. RPG leverages AS/400 architecture, they are the perfect couple.
One of the core features of Jariko is the doping mechanism: once the code is taken over by the interpreter, every single program can be replaced at runtime. This allows to write a very flexible and polyglot software, choosing the right tool for the right job and having all the java (and jvm) power and ecosystem available.
Through doping, it's also much simpler to make the architectural design needed to deal with things like SPOOLS, DATAQUEUES, JOBS, DATAAREA, etc, typical of the OS/400 operating system, where the RPG code used to run.
If you know how programming languages work, you also know that once you have a syntax three in your hands, you can do almost whatever you want. So, since RPG is best used for business applications, why don't add new high-level features to make the life of the RPG programmer easier? This is a step towards a Domain Specific Language
C PARM §§METO
C PARM §§SVAR
C EVAL PRICE=§§SVAR
C CALC_VAT(PRICE)
In this example CALC_VAT, standing for "calculate vat" does not exist in RPG, but the interpreter can handle it as a language keyword, with type check, syntax highlighting, code suggenstions, intellisense, errors an so on.
1.So it sounds like you are developing an interpreter to run an application on multiple other platforms.
Right
Mostly Kotlin, but the overall resulting system will be µ-service-based and we're going to use jvm languages.
We have ETLs. We've already been doing that since years. SQL must not have dialect-specific statements, or it has to be re-arranged, but we're thinking about that.
No. We're also not implementing DDS, SUBFILE, CLP. And absolutely none of the os/400 system apis.
Yes. Also QTEMP, RLA (read, write, chain, setll, etc...), SQLRPGLE (maybe...), /COPY
All information for developers is to be found in the Development guide.
The following list shows all the implemented features:
Jariko supports configurable logging, described in a separate document.
Special annotations can be used to write unit tests in RPG. For more details, see this document.
You can run MUTE tests in Visual Studio Code: see the documentation
- generated-src contains the code generated from the grammar
- gradle, gradlew, and gradlew.bat contain the gradle wrapper
- src contains the source code for the project and the tests
- out, and build contain temporary files
- misc contains utilities for downloading sources from AS400 (for example this ruby script)
- misc/docker: support for Docker, see instructions
- docs contains documentation
Yes, of course: see the presentation list
At the moment, we use Maven Central to publish the project.
To use Jariko in a Maven application, add the following dependencies for the core library:
<dependency>
<groupId>io.github.smeup.jariko</groupId>
<artifactId>rpgJavaInterpreter-core</artifactId>
<version>vx.y.z</version>
</dependency>
If you also want to include the examples, add:
<dependency>
<groupId>io.github.smeup.jariko</groupId>
<artifactId>examples</artifactId>
<version>vx.y.z</version>
</dependency>
To use Jariko in a Gradle application, add the following lines to your build.gradle
file:
dependencies {
...
implementation 'io.github.smeup.jariko:rpgJavaInterpreter-core:vx.y.z'
}
Here is a sample project that uses the interpreter as a library, and here is another one.
Every kind of contribution to this project is welcome. See our contributing guide for more details.
The grammar used in this project is based on the work from Ryan Eberly. It is derived from his project rpgleparser.
Some RPG Examples are from Claudio Neroni
Another source for good examples is go4as400