
How do I create my own programming language and a compiler for it - Anon84
http://programmers.stackexchange.com/questions/84278/how-do-i-create-my-own-programming-language-and-a-compiler-for-it
======
mrcharles
I think it's a great question coming from a 15 year old. That's a kid who
wants to know and do everything. He'll go places.

~~~
stephen_g
It is a pretty good question - I was involved on a forum about operating
system development and we would get so many people coming with no experience
and asking questions in exactly the opposite way.

Pretty much people would say, "I know [VB6|Python|Javascript|HTML] and I want
to make an OS. Tell me how"... Like compiler design, building a kernel is one
of the most complicated types programming, and none of them had anywhere near
the coding skill or experience to do it (or the patience usually - coding an
OS for the most part is far less exciting than it sounds - the breakthroughs
are great but they usually take intense debugging and reading great deals of
the Intel and AMD manuals).

This guy has actually done some research (including reading books!), which was
unheard of from most newbies there, so he's doing far better. But if he
doesn't know how libraries are made, he should get some experience doing that
in C or C++, and will need a good grasp of Assembler if he's going to do code
generation.

------
stcredzero
NAND to Tetris

<http://www1.idc.ac.il/tecs/>

Watch this video:

<http://video.google.com/videoplay?docid=7654043762021156507#>

------
callahad
Does the idea of a self-hosting language implementation ever stop seeming
slightly magical?

~~~
kingkilr
Eh, you work on one for long enough and you start to take it for granted.

------
Jun8
The better (and maybe more interesting) question would be is _why_ people
create new languages, i.e. what aspects of existing languages bugged them
and/or how do they discover deficiencies which motivate them to create a new
language.

~~~
bartwe
For me it was a big case of Not Invented Here syndrome that caused me to make
my own compilers and languages. It is a great way to learn deep stuff about
how languages work, and helps me debug issues that others can't fix.

~~~
mdaniel
As someone who has to endure the results of NIH, I want to say that such
thinking is a poison to the industry.

I wish that, if someone is overcome by the vapors of the NIH disease, such a
person would confine their reinvention of the wheel to their personal time and
not introduce such silliness to the workplace.

Of course, I wish for lots of things.

~~~
nitrogen
I got the impression from bartwe's post that the NIH symptoms _were_ confined
to personal/learning time.

------
anamax
I'm surprised that no one suggested "Structure and Interpretation of Computer
Programs". (The "Little Lisper" suggestion is reasonable if SICP didn't
exist.)

------
Yaa101
The concept of Assembly language is not that hard, provided one starts with
simpler processors, simple said it's mapping processor codes to 3 letter
instructions. Processors nowadays are way more complicated than the ones of
yesteryear, my tip is when one really wants to understand is to start with a
beast like the 6502, it's a straight forward processor and there is tons of
documentation for it, also there are many emulators of the machines that used
the 6502/6510. In the process you learn concepts like memory mapped graphics
and IO. You can use that knowledge to explore and build on modern day
processor concepts like segmented, protected and virtual memory and things
like OS/User separation or floating point processing. Compilers are mainly
programs that translate higher level languages to Assembly language. A lot of
today's languages like Python, Perl or Ruby are not compiled but interpret and
bring yet other advanced language concepts like automatic memory allocation
and garbage disposal, but also higher up algorithms like sets, dictionaries
and collections etc... Start in the recent past like the 80's and work your
knowledge towards the present, there is not much use to go further back than
the 80's because before that era there were not that many standard solutions
for these concepts, only historians want to know about things like mercury
delay line memory, crt scanline memory, core memory, programming panels and so
on.

------
sixothree
And not a single reference to Programming Language Pragmatics.

~~~
spacemanaki
PLP is pretty good, but I found it didn't live up to the reviews and
recommendations. The chapter at the beginning on parsing just flew by too fast
to be genuinely useful. The rest of it seemed to follow that trend of breadth
rather than depth.

That being said, I found EOPL 3ed also didn't live up to it's reputation. I
don't really know what I'm looking for in an introductory PL text, something
that could bridge the divide between the end of SICP and the more advanced,
serious PL stuff. I don't know if such a text exists.

~~~
kwantam
Have you looked at Programming Languages: Application and Interpretation [1]
by Krishnamurthi? It doesn't address your concern about parsing---it's
explicitly excluded from the book---but I found it to be a reasonable follow-
on to SICP and a relatively enjoyable read to boot.

[1] <http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/>

~~~
spacemanaki
PLAI is on my short list for new reading, but thanks, that's good to know re:
parsing.

I actually think that skipping parsing altogether, the way a lot of Lispy
texts do is the way to go for intro PL stuff, because you can get to
interesting stuff much faster.

My gripe about PLP is that after deciding to cover parsing and scanning, he
goes too fast. I might have been happier if he'd skipped it altogether.

~~~
Psyonic
I wish my list for new reading was short. Amazon wishlist is near 1000 books
now :(

------
siphr
Two words. Lex and Yacc. These are freely available tools that should (if
nothing else) atleast give you solid launching platform into writing your own
language.

