Optimizing and pre-evaluating

Many present compilers try to simplify mathematical expressions during compile time in order to ease the burden of the final executable. Naturally this results in faster runtime code execution in some cases and even the size of the executable may shrink a bit. I’ve been working on some similar mechanics for CoolBasic V3 compiler, and at this point in time I’ve grown pretty satisfied with it. Most constant expressions will now be pre-calculated, meaning that statements get shorter before the actual syntax checks begin. All of this will help me to establish as bug-free development as possible. Compilation based on very very strict rules, in the end, tends to prevent exceptions in the algorithms. Simplicity is beautiful.

This kind of optimization is, however, very hard to carry out perfectly. An an example of this matter would be the following expression to optimize well:

1 + 2 + a [into] 3 + a

But grouping is a bit trickier:

1 + a + 2 [into] 3 + a

For now, I decided to leave as it is i.e. only the first example remains in effect.

Another funny part of this implementation of pre-evaluation is that the compiler’s source code almost doubled just by adding this feature. You can’t really say it wasn’t worth it, though. As a result, you gain:

  • Faster runtime execution
  • Faster compilation
  • Smaller executable
  • False conditions (like If/Until/While 0) can be stripped from the final executable

So today I made a blog!

Hello, everyone!

It really seems that blogs are getting more popular every day. Eveyone has one. I haven’t felt any urge to speak my mind in public before, but this time I might actually have something to say. New version of CoolBasic is in development, so I thought this would be a perfect time to set up one myself. Blogging is a new thing to me, and I consider it exciting – atleast for now 😉

Some people want their voices heard, some people just write things down so they can later return and look back. Be it out of amusement, curiosity, or just for memories. I, personally, am writing this blog just for fun. There’s no catch, no target group, nothing. Just an archive of thoughts on the long road of CoolBasic’s development progress.

Some things are better to be kept in secret. I won’t be going to reveal technical details of how the future-coming CoolBasic is going to work internally (atleast I’m trying not to). There be spies, you know. Instead, those who are interested, might find hints of what to expect. At this point I’m just going to say… if things go as planned, it’s worth waiting!

Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress