Zero

Zero
Zero

07 abril 2011

Prowl 2.0

The development of the new Prowl compiler is steaming at good pace, only lacking:

- decission: if
- loops: for, foreach, do... while y while.
- Dynamic inheritance.

It is already fully implemented:

- definition of local references
. messages
. assignments

It is able to compile most programs except those with loops and decisions

Prowl 2.0

El desarrollo del compilador sigue avanzando, y en este momento sólo le faltan:

- decisión: if
- repetición: for, foreach, do... while y while.
- Herencia dinámica

Estando ya implementado:

- definición de variables locales
. mensajes
. asignaciones

Es capaz de compilar la mayoría de programas, excepto aquellos con decisiones o repeticiones

08 marzo 2011

prowlc

prowlc, the new compiler for PROWL, said: ¡Hola, mundo!

With this program as input:


/*
Hola, mundo desde PROWL

jbgarcia@uvigo.es
*/


obj HolaMundo: ConsoleApplication {
mth + doIt()
{
System.console.writeLn( "¡Hola mundo!" );
return;
}
}


There are a few minor syntax changes. Before, the end of the object was marked with the reserved word endObject, while now it is possible to use the curl braces. Before, the programmer had to write object, method and attribute, when obj, atr and mth are just as valid. As it can be inferred from this, the old syntax is still valid as well.

prowlc published:


Prowl - PROtotype-Writing Language - A Zero's programming language
v2.0 20100831


f: 'HolaMundo.pwl'
Compilando...
Generando...

Obj(s): 1
EOF('HolaMundo')


Generating...


OBJ HolaMundo ConsoleApplication

MTH + doIt
STR ¡Hola mundo!

ASG __gp1
MTH System.console writeLn __gp1
RET
ENM

ENO


Though it is not finished (not at all, only some kind of messages are allowed), it is a big first step. The objective is to have a compiler as stable as the virtual machine. Unfortunately, the current compiler was developed by a student and it has too many cumbersome cases.

About implementation, it is not lex&yacc based, nor it is based in any of its variants. PROWL has a simple syntax that allows to write a simple syntax and semantic analyzers. The different behaviours of the linux and windows versions of the current compiler decided me about this.

prowlc

prowlc, el nuevo compilador de PROWL, ha dicho: ¡Hola, mundo!

Ante este programa:


/*
Hola, mundo desde PROWL

jbgarcia@uvigo.es
*/


obj HolaMundo: ConsoleApplication {
mth + doIt()
{
System.console.writeLn( "¡Hola mundo!" );
return;
}
}


Nótese que hay algunos cambios de sintaxis. Antes, el fin de objeto se marcaba con endObject, mientras que ahora se pueden usar llaves. Antes, era necesario teclear object, method y attribute, cuando obj, atr y mth son igual de válidas. Tal y como se deduce de lo escrito, la antigua sintaxis sigue siendo perfectamente válida.

prowlc ha dicho:


Prowl - PROtotype-Writing Language - A Zero's programming language
v2.0 20100831


f: 'HolaMundo.pwl'
Compilando...
Generando...

Obj(s): 1
EOF('HolaMundo')


Y ha generado esto:


OBJ HolaMundo ConsoleApplication

MTH + doIt
STR ¡Hola mundo!

ASG __gp1
MTH System.console writeLn __gp1
RET
ENM

ENO


Aunque no está terminado, ni mucho menos (sólo soporta algunos tipos de mensajes en este momento), es un gran primer paso. El objetivo es tener un compilador de prowl tan estable como la máquina virtual. Desgraciadamente, el compilador actual fue desarrollado por una estudiante y tiene demasiados casos particulares.

Sobre la implementación, decir que no está basado en Lex & Yacc o variantes. De hecho, no está basado en nada: todo ha sido construido desde el principio. La gramática de PROWL es suficientemente sencilla como para no tener que escribir una analizador léxico y sintáctico complicadísimo, y la diferencia de comportamiento entre las versiones de Linux y Windows del actual compilador me decidieron en este sentido. No me arrepiento, desde luego.