Make small fixes to compiler series posts
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
33cd4f5f68
commit
b04d82f0b3
|
@ -40,7 +40,7 @@ Let's go over some preliminary information before we embark on this journey.
|
||||||
#### The "classic" stages of a compiler
|
#### The "classic" stages of a compiler
|
||||||
Let's take a look at the high level overview of what a compiler does.
|
Let's take a look at the high level overview of what a compiler does.
|
||||||
Conceptually, the components of a compiler are pretty cleanly separated.
|
Conceptually, the components of a compiler are pretty cleanly separated.
|
||||||
They are as gollows:
|
They are as follows:
|
||||||
|
|
||||||
1. Tokenizing / lexical analysis
|
1. Tokenizing / lexical analysis
|
||||||
2. Parsing
|
2. Parsing
|
||||||
|
|
|
@ -103,7 +103,7 @@ generate a state machine, and convert it into code to simulate that state machin
|
||||||
that code as part of our compiler. This way, we have a state machine "hardcoded" into our tokenizer,
|
that code as part of our compiler. This way, we have a state machine "hardcoded" into our tokenizer,
|
||||||
and no conversion of regex to DFAs needs to be done at runtime.
|
and no conversion of regex to DFAs needs to be done at runtime.
|
||||||
|
|
||||||
#### The Practice
|
### The Practice
|
||||||
Creating an NFA, and then a DFA, and then generating C++ code are all cumbersome. If we had to
|
Creating an NFA, and then a DFA, and then generating C++ code are all cumbersome. If we had to
|
||||||
write code to do this every time we made a compiler, it would get very repetitive, very fast.
|
write code to do this every time we made a compiler, it would get very repetitive, very fast.
|
||||||
Fortunately, there exists a tool that does exactly this for us - it's called `flex`. Flex
|
Fortunately, there exists a tool that does exactly this for us - it's called `flex`. Flex
|
||||||
|
|
Loading…
Reference in New Issue
Block a user