Ask HN: Does the design of a programming language includes writing its compiler?
1–5 of 5 posts
Re: Ask HN: Does the design of a programming language includes writing its compiler?
#2I guess it depends on your motivations for creating the language. Programmers will often design a language and write the compiler/interpreter themselves as a learning experience.
Re: Ask HN: Does the design of a programming language includes writing its compiler?
#3And you do need more than a grammar; you also have to specify semantics. For example the grammar may state that you can write "x = y" at some place in your language, but what what does it mean?
Does it copy y to x, copy x to y, make x and y refer to the same object (with choices of x, y, a new thing that has the same value as x, etc.), test whether x and y are the same object, have the same value, ascertain that x and y have the same value, ensures that they have the same value by replacing their values by their average, or is y an implicit string, and do you have to write `y or $y to reference variables in expressions? Is there any side effect? For example, does the new value of x get printed to the console by default?
(Some of the options I give are 'unconventional', but you have to specify your choice)
Re: Ask HN: Does the design of a programming language includes writing its compiler?
#4Re: Ask HN: Does the design of a programming language includes writing its compiler?
#5It's often beneficial to the language for its author(s) to write the compiler as well. Without doing this, there's a tendency to cram every feature imaginable into the language (see eg. ANSI Common Lisp, Algol 68, PL/1), which tends to make it too difficult for anyone to learn or program with. The need to write a working implementation is a forcing function that keeps the language design simple and ensures that the l…
Common Lisp does inherit very very little from other Lisps like Interlisp, Standard Lisp, etc.
Common Lisp was designed by implementors. If it is 'hard' to program in it, it probably is more BECAUSE it was developed by implementors:
Gabriel: NIL (New Implementation of Lisp) -> Lucid Common Lisp
Steele: NIL
Moon: Lisp Machine Lisp -> Symbolics CL
Weinreb: Lisp Machine Lisp -> Symbolics CL
Fahlman: Spice Lisp -> CMUCL
Even the later ANSI Common Lisp was designed with implementations of its new features. For example CLOS was designed mostly by people from Xerox PARC. CLOS was at the same time implemented by them in a portable implementation called PCL, where the designed was explored and feedback was assembled from a group of users. The very people who wrote the spec for CLOS and a book about it, they also implemented it.