4 ms·
there's no type checking, which i'd say is a fairly integral part of a compiler... but it does use a parser generator to generate a parser that constructs an a
by a-dub 4y ago
there's no type checking, which i'd say is a fairly integral part of a compiler...
but it does use a parser generator to generate a parser that constructs an ast and it then iterates that ast to generate a bytecode.
that's basically a compiler, even if the language is basic expressions.
- userbinator 4y agoB has no type checking either. On the other hand, using a parser generator and not counting its output in the line count does seem like cheating.
- p4bl0 4y ago> using a parser generator and not counting its output in the line count does seem like cheating Yeah maybe I should count OCaml's standard library lines of code too. Maybe also count expanded macros and inlined functions at each call site? At which point should I stop? Are assembly language pseudo-instructions cheating too? Common, don't be ridiculous.
- wtetzner 4y agoI don’t see how, I would only count the input lines to the parser generator.
- compiler-guy 4y agoType checking is a part of semantic analysis, which the author explicitly says isn’t present. Even so, the language it is compiling has only one type, so it isn’t possible for a program to have type errors. Just like in C++ one never need to check if a reference is null—it simply can’t be expressed in the language, thus preventing any errors of that kind, a single type prevents all kinds of type errors. One might argue that this is the most powerful way to do type checking. It simply isn’t possible to have an error.
- a-dub 4y agofair enough. regardless i think it's a work of art and meets the definition of compiler in my mind. i hope that the author chooses to publish the rest of their course materials and does so in a language i understand. i expect they are/will be fantastic.
- wtetzner 4y ago> there's no type checking, which i'd say is a fairly integral part of a compiler... There are compilers for dynamically typed languages.