Add small improvements to the small improvements post.

This commit is contained in:
Danila Fedorin 2019-08-27 00:26:02 -07:00
parent 8ba501bd84
commit b012e557f0

View File

@ -69,7 +69,7 @@ but we don't need indentation, or recursion:
{{< codelines "C++" "compiler/04/ast.cpp" 116 121 >}}
Let's print the bodies of each function we receive from the parser:
{{< codelines "C++" "compiler/04/main.cpp" 35 50 >}}
{{< codelines "C++" "compiler/04/main.cpp" 44 53 >}}
### Printing Types
Types are another thing that we want to be able to inspect, so let's
@ -83,11 +83,13 @@ The implementation is simple enough:
Let's also print out the types we infer. We'll make it a separate loop
in the `typecheck_program` function, because it's mostly just
for debugging purposes.
for debugging purposes:
{{< codelines "C++" "compiler/04/main.cpp" 34 38 >}}
### Fixing Bugs
We actually discover not one, but two bugs in our implementation thanks
to this output. Observe the output for `works3.txt`:
to the output we get from printing trees and types.
Observe the output for `works3.txt`:
```
length l:
CASE:
@ -127,7 +129,8 @@ We replace the fragment with the proper reverse iteration:
### Setting up CMake
This would be extremely easy if not for Flex and Bison. We start with the usual:
We will set up CMake as our build system. This would be extremely easy
if not for Flex and Bison, but it's not hard either way. We start with the usual:
{{< codelines "CMake" "compiler/04/CMakeLists.txt" 1 2 >}}
Next, we want to set up Flex and Bison. CMake provides two commands for this: