Before preparing myself for New Year's Eve, I decided to finish eddic 1.2.1, and it's done !
This version is a small one, but add several improvements to the language and to the standard library. Many bugs have been fixed especially in the support of dynamic arrays and structures.
The first important change is that string has been renamed to str and that a new struct is available: string. Indeed, str is now a simple raw string where string has more capabilities like concatenation. This new version also supports concatenation of string and int, which was not possible before. In the future, I'll try to add more features to the string class.
Another improvement of the standard library is the inclusion of a vector structure. The vector is a dynamic arrays, which means that it can be automatically resized when necessary. For now, the operations available on vector are very few, but more will be added later. Especially, it is not possible now to add elements in the middle of the array, but it will be done, perhaps in the next eddic version or the next after this one. Adding the vector has also meant to add new features to the language.
Dynamic arrays of structures is now supported. And, the delete operator can be applied on any left value now, not only variables. It means that "delete a;" is now a valid code.
Finally, in the side of the language, printB has been rewritten in EDDI instead of raw assembly. In the next versions, I will continue to rewrite as much as possible of the assembly stuff into EDDI. There are several advantages. The first one is that I don't have to maintain two versions (one for 32 bits and one for 64 bits). Another advantage is that it can profit from the eddic optimizations. And it is more readable and maintainable in EDDI.
A new optimization is now available. If a function is always called with the same value for one of its parameters, the value is propagated inside the function. In the future, it will be improved to suppport propagation for instance in more than X% of the case, creating several versions of the function. The optimizations have also been a bit improved in terms of performance, making some samples much faster to compile than before. Essentially, the removal of dead basic blocks is now made in a way that it doesn't need to be run several times to remove all the dead basic blocks.
The warnings have been improved. Now, no warnings are emitted if some parts of a include are not used. And, if no elements of an included header is used, it will be warned that the include is not necessary.
The error reporting has also been improved a bit. It can now display several errors. For now, it is limited to one error by function. Doing better error reporting, would mean lots of changes in the AST passes which I don't want to do right now.
The hangman application has been fixed. It was a bug in the inliner that was causing this problem. There are now new test cases that verify that the optimizations are done. For instance, there is a test case verifying that the correct loops are removed when necessary. This is done by keeping tracks of counters like removed functions during the optimization.
The source code has also been improved. I now use less shared_ptr and rather rely in storing the elements in standard container and using references directly. It result in much better code. This also improves a bit the performances by having a better data locality. For now, I have handled the given classes: eddic::Function, mtac::Function and mtac::Program, but the next version will handle more critical structures like the basic blocks and the MTAC statements which could improve the performances of the optimization by making iteration faster.
Don't hesitate to comment or to contact me if you have any suggestion (or other) about this release or for the future versions of eddic.
And happy new year !
The next version of the EDDI compiler (eddic) will be the version 1.2.2. In this version, I willl continue the work that I've done by using less shared_ptr and relying on references. I will also continue to improve the interfaces of the different class used. This version will also fix the memory leaks that I spotted in the application. There will also be new improvements on the language side, but minor one and I don't know now which ones I will pick.
You can find the EDDI Compiler sources on the Github repository: https://github.com/wichtounet/eddic
The version is available in the v1.2.1 tag available in the GitHub or directly in the master branch.