Learning #8: Let's get Fishy -- Sailfishcpp

Today was quite a long day – stuck to my schedule for once (working out morning and night) and also helped my brother out with his Jeykll blog for an hour. Thus, this blog post will be a little short 😪.


Indecision

As you can tell from my previous few posts, I am a bit all over the place in trying to figure out what to pursue this summer. It is hard. There is just so much cool stuff out there and so little time :(

Here is my list:

CLEARLY there is not enough time to learn any of these well and honestly not even quite enough to learn any of these fully given I only have at most 30-45 minutes per day.


[drum roll]… Sailfish it is!

So, since I want to get even better at C++, I think I will work on v3 of the Sailfishc compiler. In order to more easily do a complete rewrite, I have decided to start fresh. There are a laundry list of things that need to be fixed in this version. For the most part, the lexar, parser, and semantic analyzer were ok, what was really lacking was my transpiler – it made lots of incorrect assumptions and was very poorly written (read incorrect).

As a reminder, here are the limitations as described in the manual, up to date as of the 0.3.0 release:

  1. mutual recursion unsupported
  2. Impossible to import UDT’s within UDT’s
  3. Name collisions exist in code generation
  4. No concept of UDT constructors
  5. No concept of UDT private/static members
  6. Double dispatch does not transpile correctly
  7. Declaring more than one attribute accessor with a function call does not transpile correctly
  8. Functions are not first class
  9. A majority of basic functionality not supported due to limited stlib
  10. String and UDT comparison does not work due to transpilation errors.

A Sort of Hello World

Since I really need to get to sleep, I simply created a main file in src/main/ that says hello world when the executable is run:

/*
 * Robert Durst 2019
 * Sailfish Programming Language
 */
#include <iostream>

int
main(int argc, char* const* argv)
{
	std::cout << "Hello World!" << std::endl;
}

As a wise man once said “a compiler of a thousand lines begins with a single commit” - anon.