

Implementing a programming language in C, part 1 - master_wayne
http://bread-man.github.io/blog/2015/05/11/implementing-a-programming-language-in-c-part-1/

======
rpcope1
"Interpreted languages need a virtual machine to run..."

What? This doesn't seem right. I think this is only true if your interpreter
does something like compile down to byte code a la Python. In a language like
BASIC or certain implementations of Forth there should not be such an
intermediary step.

"On Linux, considering apt is your package manager, run sudo apt-get install
clang to get the Clang compiler installed."

I really like Debian, but I think there's a large portion of the Linux
community (Red Hat, SUSE, Arch, etc) guys that will feel shafted at that
statement, and probably will mutter something about Ubuntu destroying the
Linux community.

I'm sure this will be an interesting series, I just think given how hard
language design is, that I'm not yet filled with warm fuzzies about this
write-up. I think the author is doing a good thing, and going out on a limb
that most wouldn't but I think it might be good to emphasize that all best
practices may not be present.

~~~
andars
To be fair, the author (who I believe is a teenager) has included a bolded
disclaimer at the top that says as much and acknowledges the likelihood of
mistakes.

~~~
DougMerritt
Is it somehow unfair for the OP to point out such mistakes? Incorrect is
incorrect.

There are many ways to implement interpreters besides VMs, including
"threaded" interpreters and tree-walking evaluators.

I don't fault anyone for not knowing something, but that calls for asking
questions, not making incorrect assertions.

~~~
andars
No, it is completely fair to point out mistakes. I believe the OP's comment is
valuable and was mainly responding to the final sentence of that comment.
Sorry for poor wording and any confusion.

------
andars
fwiw, Python and Ruby are compiled to bytecode prior to execution as well,
just not with a separate command as with Java. Trying to explain the
distinction between compiled and interpreted gets messy fast nowadays.

~~~
cf
I think its helpful to define concepts like interpretation and compilation.
Interpreters take a program and produce a value. Compilation takes a program
and returns another program that hopefully when interpreted gives the same
value.

In some sense, python and ruby compile into bytecode, and then the bytecode is
executed using an interpreter. There are also concepts such as partial
evaluation (where you do a little interpreting while you compile) and JITing
(where you do a little compiling while you interpret) which also seem to mix
compilation and interpretation, but can be clearly specified as a particular
combination of them.

