[:: AlMuist's API Documentation ::]
On this page I explain how are the concepts of applications (which is a complete project, possibly with makefiles, documentation, and so on), classes (the basic runnable component of an application) and programming languages (of which we want to be as much independent as possible) modelized in AlMuist's.
As said before, applications should later store every information about the project as well as the way it is compiled, how the program can be ran, etc. For now however it will just contain the following information:
So it is currently up to the programmer to know what amool child must be ran, and what are the names of the source files to be generated, and what command must be ran to compile and run them
For instance, if you have your project in the file myProject, you would do something like:
> acompile @myProject.mainClass MyProject.java Reading config file /usr/local/amool/conf/amool.conf Amool 1.3.8 compiler/parser v1.4.2 - by Maxime Gamboni > acompile @myProject.helperClass Helper.java Reading config file /usr/local/amool/conf/amool.conf Amool 1.3.8 compiler/parser v1.4.2 - by Maxime Gamboni > javac MyProject.java Helper.java > java MyProject
Classes are what the executable part of a project is made of (AlMuist's assumes the underlying language to be object oriented, like Java. To generate code for a language that is not object oriented, the notion of classes must be somehow emulated in the language description (I will make an example in C someday :-)
Java being for now the only supported language, a class, in AlMuist's API, is currently a transcription of Java classes into Amool, ie a structure that has a name, contains methods, attributes, constructors and inner/nested classes, that extends one class and implements interfaces
I won't bother you with heavy details here, you can look at the reference (okay, sorry, I have not yet written it, but it will come shortly :-), play with the below examples or those in the archive, or look at the amool implementation of classes, methods, constructors etc
All application should have a child (typically named @language) that inherits from a language specification, which
defines basic components of source code in that language (for instance
what syntax do we use to declare a local variable of a given type ?),
which can in turn be used by the rest of the application to be
independent of the programming language.
I have chosen to keep
these descriptions empty until I code support for another language
than Java, so I will see more precisely what kind of building blocks a
language should define to describe itself (so for now everything is
hardcoded in Java, later I will replace all Java code by references to
these generic building blocks)
Let's see a little example of a silly hello-world application before entering into details:
&=!language &=super @javaLang && && &=super @application && &=name HelloWorld && &+mainClass.methods &=super @langMethod && @super &=name printHello && &+early System.out.print("Hello"); && && &+early printHello(); System.out.println(" World !!"); &&
This code tells, in order:
When compiled, this code generates the following:
> acompile @demo.mainClass Reading config file /home/max/almuists/amool_1.3/conf/amool.conf Amool 1.3.8 compiler/parser v1.4.2 - by Maxime Gamboni /** (this class was generated with Amool) */ public class HelloWorld { /** main method */ public static void main( String args[] ) { HelloWorld instance = new HelloWorld(); instance.go(args); } /** the nonstatic main */ public void go( String args[] ) { printHello(); System.out.println(" World !!"); } public void printHello( ) { System.out.print("Hello"); } }
So what can we do when writing an application using the AlMuist's API?
The @application class gets information from the following children:
The @langClass class gets information from the following children:
For more details, have a look at the reference (coming soon!! :-) or the source code of AlMuist's.