Based on Pixeled's (youtube.com/@pixeled-yt) "Creating a Compiler" series.
Why choose C++ for this task? No idea, but enjoy the following quip from uncyclopedia.com's page on the C++ language.
"It gives programmers more control by allowing them to overload and override functions, while being backwards compatible with the C language's ability to overrun buffers. The language is also incredibly hard."
Anyway, here's the version notes:
-
v1/aCorresponds to timestamp of 0:00-19:55 in part one of the video series. At this point, the directory contains the .asm file of a program to return an exit code, object file output by NASM (nasm), executable produced by GNU Linker (ld), and a Bash script to automatically check the program. -
v1/bCorresponds to timestamp of 19:56-27:51 in part one of the video series. This is an interim version used to checkcmakeand C++ are working on the system. Version 2 only contains a basic CMakeLists.txt file and a C++ "Hello, World!" program. There is an included Bash script to automate testing of the compiler at this point. -
v1/cCorresponds to timestamp of 27:52-38:21 in part one of the video series. The third version builds upon the CMake and C++ files fromv2and introduces the code needed to read the contents of the Hydrogen file (test.hy).A step is added to the Bash script which runs thehydroexecutable ontest.hyto return the Hydrogen file contents as a string. -
v1/dCorresponds to timestamp of 38:22-57:56 in part one of the video series. File structure remains the same asv03with tokenization added to themain.cppfile. With the exception ofmain.cppall file contents remain unchanged. -
v1/eCorresponds to timestamp of 57:57-1:05:10 in part one of the video series. All conditions related tov04are the same. File structure and contents with exception ofmain.cppare unchanged. Introduces conversion of tokens to Assembly code, but lacks the functionality to output the Assembly code to a file of its own. -
v1/fCorresponds to timestamp of 1:05:11-1:11:02 in part one of the video series. At this step, pre-existing file structure is unchanged. Additional files are added, includedout.asm,out.o, and theoutexecutable. Thetest.shscript receives an update to continue providing a complete and automated test of the compiler at this point in development. Functionality to output Assembly code to a file of its own is added for this version. -
v2/gCorresponds to timestamp of 0:00-28:54 in part two of the video series. Refactoring takes place in this version. By now, the tokenization has been abstracted to a header file. Several processes related to tokenization have been improved. Corresponding code withinmain.cpphas been reduced. Thetest.shscript has been improved with absolute paths which allow it to be from anywhere on the local host. All other file contents and structure have remain the same. -
v2/hCorresponds to timestamp of 28:55-1:05:47 in part two of the video series. Parsing and code generation are abstracted to.hppfiles. Agrammar.mdfile is now included. Code inmain.cpphas been modified or reduced to use the contents of header files accordingly. Other file contents and structure are unchanged. -
v3/iCorresponds to timestamp of 0:00-TBD in part three of the video series. At the time of writing, this version is a work-in-progress.