EDDI Compiler 0.6.0 : Arrays

This new version of the EDDI Compiler was faster to finalize than the previous.

The main feature of this release is the use of arrays. You can now use arrays in the EDDI code. You can declare global or local arrays and pass them as parameters to the function. In the assembly, there is certainly still some optimization to perform, but the code works well for now. A new loop is also available the foreach loop for arrays. The loop iterates through each element of the array.

I also performed some new improvements in the compiler speed.

The local and global variables now have default values (0 for int and the empty string for strings). So you can omit the value in the declaration.

I removed the dependency to the C library with replacing malloc with a little memory allocation function I wrote myself. This function is very simple and only use sys_brk to allocate memory directly after the program. You cannot release the memory for now, but that was the same before.

The compiler is now able to warn you if you declare something and you don't use it (parameter, variable, function). Moreover, if you enable the optimization, the functions and variables that are not used will not be compiled.

I made a little fix to the print_integer function to handle negative numbers. Before that, they were printed but in two's complement, now they are printed in the negative form (-344 for example).

I don't know exactly yet what will be included in the next release of the EDDI Compiler. Probably this will be minor release with the inclusion of function return types, but I'm not sure yet. In the future, I also want to add some kind of structure to the program.

You can find the compiler sources on the Github repository : https://github.com/wichtounet/eddic.

The exact version I refer to is the v0.6 available in the github tags or directly as the release branch.

Related articles

  • EDDI Compiler 1.1.3 - Templates
  • EDDI Compiler 0.6.1 : Function return types
  • EDDIC 0.5 : Functions and foreach
  • EDDI Compiler 1.0.2 – Better pointer support and Dead-Code Elimination
  • EDDI Compiler 1.0.3 - Inlining and register allocation
  • EDDI Compiler 1.0 - Structures and Global Optimizations
  • Comments

    Comments powered by Disqus