Luke A. Guest (Archeia)
Currently dormant.
I currently have a very basic Ada95Target.java file which produces package bodies and specifications using the GNAT filename convention. In conjunction with this, I've taken the Java.stg file from codegen/templates/Java and started to modify this to produce a lexical analyser package.
Currently, a very basic scanner is produced with a tagged type in the specification. This won't compile as there is no runtime and I've not quite decided on how to implement the runtime as yet.
As I'm currently learning ANTLR and StringTemplate, this will probably take some time to achieve.
Java |
Ada95 |
Comment |
---|---|---|
IntStream |
ANTLR.Stream |
Modified to be a generic abstract type so that type checking can |
BaseRecognizer |
ANTLR.Root_Recogniser |
The word "Root" is more consistent with the Ada runtime library |
Java |
Ada95 |
Comment |
---|---|---|
LA |
Look_Ahead |
For reasons of readability |
TODO Show how to compile the runtime.
TODO Provide a quick an easy example grammar.
I decided not to target Ada 2005 as there is only 1 compiler that support the new standard, and as it's so new, it doesn't do it very well (yet). Ada 2005 would've made the runtime easier to port, as it would be possible to provide an almost 1:1 correlation from Java to Ada.
What does Ada 2005 provide on top of Ada95?
ANTLR.Lexer.Match(Self, 'A'); |
we can write
Self.Match('A'); |
which is a bit nicer.