diff options
| Commit | a41055a02138df7cc234dc6643aa805dc5d48ae5 (patch) | |
|---|---|---|
| Author | 2023-04-03 23:13:50 +0300 | |
| Committer | 2023-04-03 23:13:50 +0300 | |
| Files | 3f26cf81496b0bfc1cf3702fed51a9d9277f584c | |
| syndamia.com-a41055a02138df7cc234dc6643aa805dc5d48ae5.tar syndamia.com-a41055a02138df7cc234dc6643aa805dc5d48ae5.tar.gz syndamia.com-a41055a02138df7cc234dc6643aa805dc5d48ae5.zip | ||
| Parent | b68669d9707d59be7c4764f1a3ef19ed011b5352 (diff) | |
[blog/seoc] Minor wording changes
1 files changed, 3 insertions, 4 deletions
| -rw-r--r-- | src/blog/sane-explanation-of-compilers/index.md | 7 |
diff --git a/src/blog/sane-explanation-of-compilers/index.md b/src/blog/sane-explanation-of-compilers/index.md index 828d849..9fe11af 100644 --- a/src/blog/sane-explanation-of-compilers/index.md +++ b/src/blog/sane-explanation-of-compilers/index.md @@ -401,7 +401,7 @@ Looking at some of the more famous ones: 3. [LALR](https://en.wikipedia.org/wiki/LALR_parser). These memory optimizations, however, came at a cost: lower grammar parsing power, though LALR can work with the most grammars out of all the alternatives and still beats LL. -Unfortunately, these algorithms are way out of my area of knowledge, and furthermore a lot of parsers are custom-tailored for their language. +Unfortunately, these algorithms are way out of my area of knowledge, and furthermore most parsers are custom-tailored for their language. If you want to dive deeper, I would suggest: - [LL and LR Parsing Demystified](https://blog.reverberate.org/2013/07/ll-and-lr-parsing-demystified.html) and [LL and LR in Context: Why Parsing Tools Are Hard](https://blog.reverberate.org/2013/09/ll-and-lr-in-context-why-parsing-tools.html) by [Josh Haberman](https://blog.reverberate.org/about/) @@ -417,8 +417,7 @@ We already decided that the lexer will output tokens (and characters) to the par ## Implementing a front-end -If you want, you could implement your own lexer and parser manually, but few people do, there are already very well made tools for that. -Furthermore, at the end of the day, we want our compiler to be a singular program, or at least every layer to be a singular program. +If you want, you could implement your own lexer and parser manually, but as a start, it's better to try and use already created stuff. [Compiler-compilers](https://en.wikipedia.org/wiki/Compiler-compiler) are tools that create parsers (and more) from their normal formal definition. The two popular ones from the old days are lex and yacc. @@ -470,7 +469,7 @@ Let's look at a very simple example program: every whole number is printed as "N %% ``` -The syntax `[0-9]` is the same as `(0 | 1 | ... | 9)`, it is available in all modern regexes. +The syntax `[0-9]` is the same as `(0 | 1 | ... | 9)`, it works for any letters and is available in all modern regexes. Note that inside every regex's "body" you have an assortment of variables already set, one of them being `yytext` which is just the whole match. Additionally lex matches the longest possible match, so if we had a rule `[0-z]`, only it will be matched. |