Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are a lot you can use, what you will find easiest will depend on your experience.</p> <p>Firstly as regards the language:</p> <ol> <li>The simplest is a toy language, for example compiling an arithmetic expressions.</li> <li>Next is an assembler - again really just translating but shows the basics of parsing and turning into op-codes</li> <li>Next is probably something like C, which is very close to pure assembler, or something like LISP which is very close to pure theory.</li> </ol> <p>Next, choosing your compiler.</p> <p>You could start with an assembler - turning assembler into machine code. This was the first step in producing compilers - I'd suggest for a chip like the <a href="http://www.6502.org/tools/lang/" rel="nofollow noreferrer">6502</a> or 8080 which are both very simple. Something like the <a href="http://webster.cs.ucr.edu/AsmTools/RollYourOwn/index.html" rel="nofollow noreferrer">assembler's development kit</a> might work well for you (it comes with examples)</p> <p>Many people (including me) would argue the easiest languages to write compilers in are functional - nowadays that probably means Haskell, Scheme or Common Lisp. An example of how easy it is is <a href="http://blog.poucet.org/2007/06/simplistic-compiler-in-haskell/" rel="nofollow noreferrer">this blog post</a>. He writes a compiler that just compiles arithmetic expressions in a few lines. This might be minimal enough for you.</p> <p>Almost every introduction to writing compilers at the academic level starts with a minimal language as an example, <a href="http://en.wikipedia.org/wiki/Dragon_Book_%28computer_science%29" rel="nofollow noreferrer">the Dragon Book http://en.wikipedia.org/wiki/Dragon_Book_%28computer_science%29</a> is always recommended, but there are other good ones.</p> <p>At University I used C-- which is like C but even easier to write a compiler for. Lots of resources at: <a href="http://www.cminusminus.org/qc--.html" rel="nofollow noreferrer">http://www.cminusminus.org/qc--.html</a></p> <p>If you wanted a compiler and you know a language like Java I'd suggest something like <a href="https://javacc.dev.java.net/" rel="nofollow noreferrer">JavaCC</a>, where the language is specified using grammars. There are <a href="https://javacc.dev.java.net/servlets/ProjectDocumentList?folderID=110" rel="nofollow noreferrer">lots of example grammars here</a> - pick something simple like C to get started.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload