Skip to content
Nzen edited this page Jul 26, 2012 · 5 revisions

Deitel's simple compiler compiles simple language programs directly to simpletron instructions. The simple language is a subset of the basic language.Up wiki heirarchy; Across to computer.

Official specification. Enliterate specification. Implementations: Compiler, Postfixer, Stack, disassembler. Test facilities, example programs. (Alternative implementations: intermediate assembler, interpreter)

SIMPLE COMPILER GRAMMER:

  • <A>: <D> <X> | <D> <C> <E> | <D> <F> <E> <G> <D>
  • <C>: rem | input | let | print
  • <D>: { 0-9 } | <D><D>
  • <E>: <L> | <D> | <L> <O> <D> | <L> <O> <E>
  • <G>: goto
  • <F>: if
  • <L>: { a-z } | <L><L>
  • <O>: + | - | * | / | % | = | > | < | ==
  • <X>: end

SIMPLE COMMANDS

  • rem "" - commented string
  • input x - value from terminal
  • let x = ( 5 + 3 ) / 2 - assign via x = expression
  • print 5 - print to terminal
  • goto 6 - unconditional jump
  • if 5 >= n goto 3 - conditional jump, form of if [ expression ] goto [ line number ]
  • end - stop execution
Clone this wiki locally