Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Eddi 0.2 : Integers and variables

DZone's Guide to

Eddi 0.2 : Integers and variables

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

just pushed the last commits of Eddi 0.2.

This new version allows the use of integers. You can declare int variables and pass int values or variables to the Print operation.

I’ve also refactored the compiled to use a kind of parse tree and several phases. But now, I’m not really satisfied with the design. The classes are too strongly coupled and the parse tree is too specific I think, too many assumptions are made during the semantical analysis. But now, I don’t know how to improve that. I also think that the design and the operations will not support some more advanced adds later, I don’t know… Don’t hesitate if you have any idea or comment on the design :)

I’ve also made some changes to the Lexer in order to improve the performances, but nothing spectacular.

You can now compile this kind of code with Eddi :

int a = 1;
string b = "asdf";
Print(1);
Print("Test");
Print(a);
Print(b);
b = "new b";
Prinb(b);

The next changes will be to add operations on int and perhaps also the concat on two stirngs. I will see. I will also try to improve the design of the compiler if I found some ideas.

The sources are available on Github :

If you want to see the exact version reffered to in this subject, you can select the tag v0.2

From http://www.baptiste-wicht.com/2011/06/eddi-0-2-types-and-variables/

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}