summaryrefslogtreecommitdiff
path: root/miniasm/README.bcompiler
blob: 1f6d57d3d563c3a0b5ac779332d312faaad0caf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
they depend on
- a host
- ELF32 binaries
- execution environemnt with int 80h software interrupts to access kernel
  functions (read from stdin, write to stdout, exit) and relying on a 
  shell doing piping from and to the program
- brk/sbrk for dynamic symbol table
- one pass, only backward references

- hex1: hex source to binary, abs./rel. adressing
- hex2: one char labels for jump addresses
  .L -> label position, jmp L
- hex3: 4-byte labels, storable in 2 32-bit word
  everything is done in a stack machine with functions
  labels are strictly 4 characters, e. g. '+,,,' for operator '+'
- hex4:
  call of functions, operators, memory, array access, functions,
  stack handling
  labels are in a simple hash
  only backward references
  functions work by pushing arguments and return address onto the stack,
  return address is always the top of the stack
  => why not use call, ret? 'rot' is implemnted that way
  for compare operators it makes sense to jump to addresses maybe?
  entry point finds start by searching for a sequence of NOPs, so
  we can define all functions before using them in main
  almost portable as only the small functions really depend on the
  CPU instruction set, the main program look already lots like
  a mixture of C and LISP
- hex5
  has now a grammar
  gradually introduces constructs in intermediate languages hex4, hex5a
  and hex5b resulting in hex5c