Added few comments to documentation...
This commit is contained in:
@ -1,21 +1,16 @@
|
|||||||
# Source files
|
# Source files
|
||||||
|
|
||||||
## main.c
|
## main.c
|
||||||
Responsible for dispatching initialization,
|
Responsible for dispatching initialization, deinitialization and the compiler.
|
||||||
deinitialization
|
Only deals with the highest level of abstractions and kept clean.
|
||||||
and the compiler.
|
|
||||||
Only deals with the highest level of abstractions
|
|
||||||
and kept clean.
|
|
||||||
|
|
||||||
## eaxhla.l|y|c|h
|
## eaxhla.l|y|c|h
|
||||||
Flex/Bison scanner/parser respectively.
|
Flex/Bison scanner/parser respectively. The C source contains definitions which
|
||||||
The C source contains definitions which
|
store the abstract state and or required to construct it.
|
||||||
store the abstract state and or
|
|
||||||
required to construct it
|
|
||||||
|
|
||||||
`eaxhla.l` is strictly limited to raising
|
`eaxhla.l` is strictly limited to raising
|
||||||
errors which sabotage scanning.
|
errors which sabotage scanning.
|
||||||
(Unterminated/partial tokens.)
|
(Unterminated / partial tokens)
|
||||||
|
|
||||||
`eaxhla.y` is strictly limited to raising
|
`eaxhla.y` is strictly limited to raising
|
||||||
syntax errors.
|
syntax errors.
|
||||||
@ -24,26 +19,22 @@ syntax errors.
|
|||||||
logical errors
|
logical errors
|
||||||
|
|
||||||
## compile.c|h
|
## compile.c|h
|
||||||
Responsible for transforming the abstract state
|
Responsible for transforming the abstract state of eaxhla.c to something that
|
||||||
of eaxhla.c to something that can be understood
|
can be understood by the assembler, dispatching it and creating the executable.
|
||||||
by the assembler,
|
|
||||||
dispatching it
|
|
||||||
and creating the executable.
|
|
||||||
|
|
||||||
## assembler.c|h
|
## assembler.c|h
|
||||||
Creates machine code from an array of tokens.
|
Creates machine code from an array of tokens.
|
||||||
|
|
||||||
## debug.h
|
## debug.h
|
||||||
Defines various debug output functions or
|
Defines various debug output functions or nop alternatives for them in
|
||||||
nop alternatives for them in non-debug builds.
|
non-debug builds. Must be kept in symmetrical ballance regarding
|
||||||
Must be kept in symmetrical ballance regarding
|
`#if DEBUG ==` `1` and `!1`.
|
||||||
`#if DEBUG ==` `1` and `!1`
|
|
||||||
|
|
||||||
# Builds
|
# Builds
|
||||||
We like Gnu Make.
|
We like Gnu Make.
|
||||||
|
// X: I hate it.
|
||||||
|
|
||||||
Debug builds might be create by defining `DEBUG` as 1.
|
Debug builds might be create by defining `DEBUG` as 1. The Makefile respects
|
||||||
The Makefile respects `DEBUG` in the environment.
|
`DEBUG` in the environment.
|
||||||
|
|
||||||
Some default values are determined as appropriate for
|
Some default values are determined as appropriate for the compiling system.
|
||||||
the compiling system.
|
|
||||||
|
@ -2,7 +2,40 @@
|
|||||||
|
|
||||||
## The following instructions are fully supported:
|
## The following instructions are fully supported:
|
||||||
```asm
|
```asm
|
||||||
; XXX fillin
|
add, or, adc, sbb,
|
||||||
|
and, sub, xor, cmp,
|
||||||
|
inc, dec, not, neg,
|
||||||
|
mul, imul, div, idiv,
|
||||||
|
fadd, fmul, fcom, fcomp,
|
||||||
|
fsub, fsubr, fdiv, fdivr,
|
||||||
|
rol, ror, rcl, rcr,
|
||||||
|
sal, shr, shl, sar,
|
||||||
|
nop, retn, retf, leave,
|
||||||
|
popf, pushf,
|
||||||
|
syscall, cpuid, fnop, fchs,
|
||||||
|
fabs, ftst, fxam, fld1,
|
||||||
|
fldl2t, fldl2e, fldpi, fldlg2,
|
||||||
|
fldln2, fldz, f2xm1, fyl2x,
|
||||||
|
fptan, fpatan, fxtract, fprem1,
|
||||||
|
fdecstp, fincstp, fprem, fyl2xp1,
|
||||||
|
fsqrt, fsincos, frndint, fscale,
|
||||||
|
fsin, fcos,
|
||||||
|
enter, call, in, out,
|
||||||
|
jmp, mov, pop, push,
|
||||||
|
jo, jno, jb, jae,
|
||||||
|
je, jne, jbe, ja,
|
||||||
|
js, jns, jpe, jpo,
|
||||||
|
jl, jge, jle, jg,
|
||||||
|
cmovo, cmovno, cmovb, cmovae,
|
||||||
|
cmove, cmovne, cmovbe, cmova,
|
||||||
|
cmovs, cmovns, cmovpe, cmovpo,
|
||||||
|
cmovl, cmovge, cmovle, cmovg,
|
||||||
|
seto, setno, setb, setae,
|
||||||
|
sete, setne, setbe, seta,
|
||||||
|
sets, setns, setpe, setpo,
|
||||||
|
setl, setge, setle, setg,
|
||||||
|
bswap, bsf, bsr, loop,
|
||||||
|
loope, loopne
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2 argument instructions (t6)
|
## 2 argument instructions (t6)
|
||||||
|
@ -29,6 +29,8 @@ options:
|
|||||||
```
|
```
|
||||||
-o | --output <file>
|
-o | --output <file>
|
||||||
-a | --architecture <architecture>
|
-a | --architecture <architecture>
|
||||||
|
-c | --compile-only
|
||||||
|
-v | --verbose
|
||||||
```
|
```
|
||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
@ -80,7 +82,7 @@ For the specifics of the supported instructions consult
|
|||||||
| E | r14 | r14d | r14w | r14b |
|
| E | r14 | r14d | r14w | r14b |
|
||||||
| F | r15 | r15d | r15w | r15b |
|
| F | r15 | r15d | r15w | r15b |
|
||||||
```
|
```
|
||||||
|
// X: Legacy registers ah, ch, dh, bh aren't supported.
|
||||||
|
|
||||||
### Types
|
### Types
|
||||||
```
|
```
|
||||||
@ -104,8 +106,10 @@ float prefixes:
|
|||||||
float sizes:
|
float sizes:
|
||||||
+ 32
|
+ 32
|
||||||
+ 64
|
+ 64
|
||||||
+ 80?
|
+ 80
|
||||||
+ 128?
|
+ 128?
|
||||||
|
+ 256?
|
||||||
|
+ 512?
|
||||||
|
|
||||||
All of these types would be generically available unless disabled by some compiler option.
|
All of these types would be generically available unless disabled by some compiler option.
|
||||||
All of the traditional types would be enabled by default or require said flag to become usable,
|
All of the traditional types would be enabled by default or require said flag to become usable,
|
||||||
@ -144,6 +148,7 @@ All literal values (string or numeric) are copied as machine code.
|
|||||||
+ and
|
+ and
|
||||||
+ or
|
+ or
|
||||||
+ xor
|
+ xor
|
||||||
|
// X: Since we're in assembly, overflow, sign and parity can be added!
|
||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
```
|
```
|
||||||
@ -158,27 +163,37 @@ end <type>
|
|||||||
qualifier:
|
qualifier:
|
||||||
+ fast -> use the fastcall calling convention
|
+ fast -> use the fastcall calling convention
|
||||||
+ ? stack -> place all arguments on the stack
|
+ ? stack -> place all arguments on the stack
|
||||||
|
+ ? inline -> X: Just replace the thing.
|
||||||
|
|
||||||
type:
|
type:
|
||||||
+ procedure
|
+ procedure
|
||||||
+ ? function
|
+ ? function -> X: Return value is in accumulator register anyway.
|
||||||
|
|
||||||
### labels
|
### labels
|
||||||
```C
|
```C
|
||||||
my_label:
|
my_label:
|
||||||
```
|
```
|
||||||
Labels act like variables,
|
Labels act like variables, but should not be dereferenced.
|
||||||
but should not be dereferenced.
|
|
||||||
Feel free to use them inside jump instructions.
|
Feel free to use them inside jump instructions.
|
||||||
|
// X: Is there flex way to verify when they are used...?
|
||||||
|
// X: I don't mind adding integers and labels tho, it's based.
|
||||||
|
// X: A label is just a number calculated at compile time.
|
||||||
|
|
||||||
### Come back to later
|
### Come back to later
|
||||||
+ `register`
|
+ `register`
|
||||||
+ `volatile`
|
+ `volatile`
|
||||||
+ `extern`
|
+ `extern`
|
||||||
+ `static`
|
+ `static`
|
||||||
|
// X: We don't really need 'register' or 'volatile'.
|
||||||
|
// X: Only either of 'static' or 'extern' should be added.
|
||||||
|
// X: If it's not declared as one, then it must be the other.
|
||||||
|
// X: Same as 'const' qualifier in C, there's no 'var' one.
|
||||||
|
|
||||||
## LATER
|
## LATER
|
||||||
+ DWARF2
|
+ DWARF2
|
||||||
- ask xolatile very nicely
|
- ask xolatile very nicely
|
||||||
|
// X: Will do it, would work well with Valgrind.
|
||||||
+ linker?
|
+ linker?
|
||||||
- support ld (thereby mold/gold) for speed reasons
|
- support ld (thereby mold/gold) for speed reasons
|
||||||
|
// X: This is sadly very useful...
|
||||||
|
// X: It'll enable us to use C libraries with EAXHLA.
|
||||||
|
Reference in New Issue
Block a user