|
Remind me when this page changes!
By: Manuel Lemos. Last change: $Date: 2006/01/12 19:51:37 $
Printable version
Contents
- What is MetaL?
- Why was developed yet another language?
- How does MetaL engine work?
- What is meta-meta-programming?
- How good are MetaL generated programs?
- What are the advantages of meta-programming with MetaL?
- Who has created and developed MetaL?
- When MetaL started to be developed?
- In what language was developed the MetaL engine?
- How much does MetaL engine cost?
- What is current state of development of MetaL?
- Where can I see a sample of MetaL programs source and generated code?
- How can I try to use MetaL?
- Is there a mailing list about MetaL development?
- When will my favorite programming language be supported by MetaL?
- Are there any other meta-programming projects like MetaL?
- What is MetaL?
MetaL is shorthand for Meta-programming Language.
Meta-programming is a method to develop computer programs. It works by
generating source code in a target language from a program specification in
a higher level language.
MetaL programs source code is based on XML. MetaL compiler engine can be
used to generate the same program from MetaL source code to potentially any
target language. Currently supported target languages are PHP, Java and
Perl. The support for other languages can be added any time.
|
- Why was developed yet another language?
MetaL is not just yet another language. It is a meta-language which
means that it can generate automatically programs in traditional languages,
eventually for tasks that are tedious or take too much work to write code
manually.
Therefore, MetaL is not intended to be a competitor of traditional
languages but rather a complement that can be used to increase the
productivity of software developers.
|
- How does MetaL engine work?
The MetaL compiler engine traverses XML source code and executes actions
associated with each command tag. Actions may be immediate, like creating a
file, or generating some output, like the lines of code of a program in a
given target language.
Command actions are implemented by compiler modules. Such modules implement
the different kinds of commands of the language, like execution flow,
variable and expression manipulation, object oriented programming classes,
etc.. Each module is responsible for generating the code in each of the
supported target languages.
There are also other modules that do not generate any code but can be used
to execute or manage important software development processes like managing
the build process like with the make tool or generating project packages to
distribute or install in a production environment.
|
- What is meta-meta-programming?
If a meta-programming language can be used to generate programs in any
target language, it may as well be used to generate programs in the
meta-language itself. This means that there may be very high level commands
in a meta-language that can be interpreted to generate source code with
only lower level meta-language commands.
Translation of higher level commands in lower level ones may be done in one
or more compiler passes. In a final pass, the meta-programming compiler
generates code in a given target language. The method of developing
programs with meta-language commands that are translated into lower level
commands is called Meta-Meta-Programming or just Meta-N-Programming.
|
- How good are MetaL generated programs?
That depends on how good you are at using the capabilities provided by
the existing MetaL compiler modules. The lower level modules generate code
that reflects the commands and the logic structure of the original MetaL
source code written by the developer. The higher level modules, i.e. those
that are based on meta-meta-programming, generate code automatically
according to abstract software description that may not be so optimized as
hand written code.
Anyway, like with any compiler, the quality of the generated code is
usually subject of improvement over time. Since MetaL is an Open Source
project, anybody is allowed to inspect its source code and make it
generate better code with smarter algorithms. Naturally, contributions to
make MetaL generate better code will be very welcomed and credited to the
contributing developers.
|
- What are the advantages of meta-programming with MetaL?
The adoption of MetaL as the language for software development may
present opportunities that developers may benefit now and in the future.
These are the most important aspects of the opportunities that MetaL may
provide that can be seen as advantages:
- Language of powerful commands
Programs written in a language with powerful commands require less code
to be written. Therefore it takes to develop such programs and
consequently, less time to market them.
If programs are written with less code, they will eventually have less
bugs, which leads potentially to higher code quality. Programs developed
with less code are also easier to maintain, taking less time to develop new
features, leading ultimately to greater user satisfaction.
- Domain specific languages
A programming tool that is appealing to less qualified developers, may
also be appealing to experts on areas that are important for a software
product. For instance, a business manager could define business rules to be
implemented by a software product, or a translator could localize a
software product.
These experts could participate directly in the development of a software
product, especially if they do not have to learn traditional programming
languages.
Domain specific languages could be used by these professionals if they are
easy to learn and understand. Also, domain experts that are not
programmers, are easier to find and less expensive to hire because they do
not all the qualifications.
- Re-targetable Programming
If it can generate a program in different programming languages, it may
as well generate its code in a suitable manner to run optimally on
different platforms, even those that do not exist today.
- Future-proof Software
The languages that are most appropriate for developing applications
today, may not be the best choice for developing future applications.
Whatever are the languages of choice in the future, MetaL programs and
components may not need to be adapted to be generated in the languages of
the future.
|
- Who has created and developed MetaL?
- When MetaL started to be developed?
MetaL development started in the middle of 1999.
|
- In what language was developed the MetaL engine?
MetaL was completely developed in PHP.
The current implementation of MetaL compiler engine and the available
modules were developed with more than 20,000 lines of PHP code. PHP was
used because it provides a good set of powerful commands to dynamically
manipulate text strings and associative arrays that were crucial for the
rapid development of the MetaL engine.
PHP is a scripting language that was originally meant for Web programming.
It may seem odd to the use PHP for a heavy task such as compiling source
files. Today PHP is not such a slow language, thanks mostly to the
Zend engine which is an integral part
of the PHP runtime engine. The MetaL compiler engine also makes extensive
use of caching of previously parsed XML files to speedup the compilation
process.
|
- How much does MetaL engine cost?
MetaL is an Open Source project. It is being released with a
BSD like
software license. Basically this means that you are free to copy and
modify it at will as long as you preserve the original copyright notices
and license disclaimers.
MetaL was not developed with any commercial intention, so it is released
as an Open Source project. This way others can benefit and eventually
contribute with bug fixes and enhancements.
|
- What is current state of development of MetaL?
MetaL has been used in real world applications since the beginning of
its development. However, it was decided that it would be released as
an Open Source project only when the proof of concept is made. The proof
of concept consists of generating the same program in different target
languages from the same MetaL source code.
The proof of concept was made in early 2002 by generating either in PHP and
in Java a class and a test program to
generate arbitrary XML
documents. The test program executed from either the target languages
outputs the exact same XML document.
The class also contains embedded documentation information that is used to
generate automatic documentation in HTML. MetaL can generate automatic
documentation with syntax and examples that conforms with the target
language of choice, i.e. documentation for PHP appears with syntax and
examples in PHP. The same for Java or any other language that is supported.
Initially MetaL was just generating PHP. The effort that made it generate
also Java was huge due to significant differences between the languages.
The way MetaL compiler modules worked was rethought and a significant part
of the modules was rewritten to abstract better the target language code
generation. Support for generating code in Perl was started but is not yet
finished due to the lack of time.
At this point it is expected that the MetaL engine does not require more
significant changes to support other languages, although some changes may
be needed to support differences of languages that were not yet
anticipated.
Anyway, MetaL is considered to be ready for public evaluation and so its
source code is opened.
|
- Where can I see a sample of MetaL programs source and generated code?
- How can I try to use MetaL?
First, you need to download the MetaL
engine source code. It comes with three modules in directories named
metal which is the MetaL project source code, xmlparser,
forms and metabase which is a database abstraction
package for developing portable database applications in PHP.
The MetaL source tree comes with two projects that you can try to build.
One is a simple Hello World! project located in the directory
metal/test/helloworld. Another is a library of ready to use
components made of classes of objects that is located at
metal/library.
To build each project, go into the respective directory and run from the
command line:
php -q build.php PHP
to generate the resulting PHP script or
php -q build.php clean
and
php -q build.php Java
to generate the Java version.
Several classes of library project have documentation that can be build with:
php -q build documentation PHP
or
php -q build documentation Java
You need PHP with XML module enabled. For Windows, the version available
from here was compiled with
XML support and only needs to have it enabled in the PHP configuration.
|
- Is there a mailing list about MetaL development?
- When will my favorite programming language be supported by MetaL?
For the time being there is not much time or motivation to develop the
support for any more languages. However, since MetaL engine is very
modular, it is very easy for anybody with some free time to add the
necessary modules to support other languages.
Anybody interested to support other languages is very welcomed to do so and
may join the MetaL development mailing list to obtain the necessary support.
|
- Are there any other meta-programming projects like MetaL?
Meta-programming is not exactly a new concept. For instance programs
like autoconf
are able to produce shell scripts to automatically configure software
source code packages so they can be built according the capabilities
of the software of system where they are being installed. Programs like
this help the users and developers to configure their software
automatically, thus without having specify all configuration details
manually.
Using XML as source code is also not a new concept either. For instance,
x++ is a
programming language that uses XML as source code.
There are certainly other XML based language and other meta-programming
languages. I am not aware of any other XML based meta-programming language
but it is possible that others may exist as nobody has the monopoly of good
ideas.
|
|