News for hackers. Stuff that matters.
Re:Show HN: A compiler and VM for a simple language, in 150 ... by a-dub on Saturday July 16, 2022 @05:39PM (#32122226)
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.

Re:Show HN: A compiler and VM for a simple language, in 150 ... by compiler-guy on Saturday July 16, 2022 @10:50PM (#32124026)
Type 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.

Re:Show HN: A compiler and VM for a simple language, in 150 ... by a-dub on Sunday July 17, 2022 @11:56AM (#32127906)
fair 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.
Re:Show HN: A compiler and VM for a simple language, in 150 ... by userbinator on Saturday July 16, 2022 @06:13PM (#32122425)
B 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.

Re:Show HN: A compiler and VM for a simple language, in 150 ... by p4bl0 on Saturday July 16, 2022 @06:22PM (#32122476)
> 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.

Re:Show HN: A compiler and VM for a simple language, in 150 ... by wtetzner on Sunday July 17, 2022 @06:26PM (#32132086)
I don’t see how, I would only count the input lines to the parser generator.
Re:Show HN: A compiler and VM for a simple language, in 150 ... by wtetzner on Sunday July 17, 2022 @06:25PM (#32132078)
> there's no type checking, which i'd say is a fairly integral part of a compiler...

There are compilers for dynamically typed languages.