[nycphp-talk] A translation programming language translation standard
Nathaniel Gibson
ngibson at wans.net
Tue Nov 22 22:36:10 EST 2005
I'm starting a new sourceforge project based on
creating a standard language for the use of
translating and interpreting languages from one to
another. The resulting project will be an engine
called SILC.
I'm going to be licensing the source code for this
engine as closed source at least for awhile as I have
plans to make much money on some of this tool's
possible applications. For those of you who don't know
what this program is, the name is pretty
self-explanatory, but it's an engine that, given
tranlation libraries, has the possibility of
translating any programming language to any other
programming language, or even to english, or
russian... or whatever language translation the
library developer can imagine. The library files are
written in SILC code which is my own language for
translating languages.
The engine takes in a piece of code or a file written
in the input language, and outputs a file written in
the output language. I will soon put up a site on how
the SILC language works on sourceforge. Here's some
actual translations from the current pre-alpha
version:
The user inputs PHP code:
if ($harman == true || $booty != false &&
substr($txt,0,1) == "a") print("Hello World");
Outputs code in QBASIC language:
IF harman$ = true OR booty$ <> false AND
MID$(txt$,1,1) = "a" THEN PRINT "Hello World"
Outputs code in English language:
if the variable harman is equal to true or the
variable booty is not equal to false and a sample the
length of 1 characters of the variable txt starting at
character 1 is equal to "a" then print the text "Hello
World"
The output code above is actual program output. The
difference between translating an input language to QB
and translating it to english is simply altering the
rewrite rules and some of the flag options to format
the output correctly. The code above was translated
using three rewrite rules! I created one rule for If,
one for substr, and one for print.
I'm in the pre-alpha phases of the project as I just
recreated it last weekend from scratch in PHP after a
four year downtime for this project. So far, I've made
much progress because I attacked the coding of the
translation engine from a completley different angle
and it's working now, whereas before I got stopped at
the important part. I've created the line by line
translation function first and I have yet to create
the part of the engine that will read a translation
libary and an input file performing translation
functions on a whole program scale. So far, I've
envisioned how I need to do it and it won't take much
work for a version 1 to be released.
Creating the engine is the easy part but creating all
of the translation libraries is quite a formidable
task. Although I have made the silc code syntax very
easy to use, it will still take some basic knowledge
of two languages and how they behave to create a
translation library file. More about that and the
syntax of a SILC Library File (SLF) later on the
sourceforge project site. I'll be posting the project
homepage url when I get it. The translation libraries
will be open-source and those are mainly what the
sourceforge project will be about creating.
The uses for this program are boundless, but this
project will mainly be focusing on the use of it for
free and paid translation of source code to a wide
range of clientelle. The project website will include
a user interface in which users will be able to paste
source code written in it's native language in a text
field and translate it to another language by
selecting the language and clicking the "Translate"
button for free or they can translate larger files on
a paid account.
Another use we will be exploring is the translation of
source code into english for educational purposes.
Users who are already developers would be able to
figure out how to code a specific algorithm that's
perhaps written in a programming language they do not
understand. Users who are not already developers can
easily learn advanced concepts.
Anyone who might be interested in creating library
files for any reason and for any language, please
reply to this message.
More news later,
Nate
More information about the talk
mailing list