Simple Little Compiler

A reasonably complete but very simple compiler
Download

Simple Little Compiler Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Publisher Name:
  • Rowan Crowe
  • Operating Systems:
  • Windows All
  • File Size:
  • 50 KB

Simple Little Compiler Tags


Simple Little Compiler Description

SLC was developed to be a reasonably complete but very simple compiler. SLC stands for "Stupid Little Compiler", but I've decided to be a bit more constructive and rename it "Simple Little Compiler". As an experiment I decided to abandon the still somewhat kludgy parsing of the new MoonRock compiler (which hasn't been released) and instead use a stack method for evaluation. It is based on CALC (supplied with MoonRock and in a separate "compiler bits" archive), and generates code on the fly rather than attempting to optimise in intermediate form like CODEGEN does. This complete lack of optimisation is done deliberately to ensure the compiler is as simple as possible, yet still functional. The code is produces is VERY inefficient to look at and would probably make any competent assembly programmer burst into tears, but it works. The idea with this small and simple compiler is to write a set of library routines (this time in native SLC, not in 80x86 ASM like MoonRock's library), along with some necessary low level "glue" code in 80x86 format. Then, rewrite the compiler in native SLC. At this stage we have a complete compiler and set of library routines which are portable - only the low level glue code needs to be rewritten for a new processor or operating system, plus some modifications to the code generator. Of course, life is not as simple as that, but porting this compiler + library to another processor or OS will be a lot simple than say, trying to port MoonRock, which is written in QuickBASIC with an ASM library - definitely unportable material! At this stage the compiler generates something close to an output that can be assembled directly, but you may still need to edit the filename.asm file before it can be successfully assembled. Note that I'm using TASM as an assembler and did whatever I needed to in order to get it to work. I don't know how well it work with MASM. Remember - this is just a simple bootstrap to get the second version working!


Simple Little Compiler Related Software