20f729d0fd
Refactoring Adding error handling Adding a clang format file Updating gitignore Updating TODO |
||
---|---|---|
header | ||
src | ||
test | ||
.clang-format | ||
.gitignore | ||
design.txt | ||
LICENSE | ||
Makefile | ||
README.md | ||
TODO.txt |
Assembler
CLI Anwendung geschrieben in C
Der Assembler wandelt das geschriebene Assembly in ein Abbild des Speichers für den EIPA Prozessor um. Dieses Speicherimage enthält dann die Instructions in einer für den EIPA Prozessor lesbareren Form.
Er ist im Grunde aus 4 Bausteinen aufgebaut:
1. Lexer
Der Lexer nimmt die die Datei mit geschriebenem Assembly, und wandelt sie in die einzelnen Bestandteile (tokens) um. Er beachtet auch wenn z.B. zwischen den Teilen der Anweisung mehrere Leerzeichen gesetzt sind, damit die anderen Teile des Assemblers damit keine Hindernisse haben. Er wandelt z.b. die Zeile INP 31 ; Irgendein Kommentar In die teile |INP|, |31|, |Ende der Instruction| um.
2. Fehleranalyser
Der Fehleranalyser nimmt die Tokens aus dem Lexer, und prüft z.B. ob die Adresse einer Instruction zu groß ist, ob bei einem Befehl der eine Adresse braucht eine gegeben ist, ob tippfehler vorhanden sind, usw. Wenn er einen Fehler findet bricht er das Programm ab.
3. Target code generator
Der Target code generater wandelt die Tokens aus dem Lexer, nachdem sie auf Fehler überprüft wurden, in den für den EIPA Prozessor lesbaren Maschienen Code um.
4. Image saver
Der Image saver speichert den generierten Maschienencode in ein EIPA speicherimage ab, das danach von dem Prozessor in den Speicher geladen werden kann, und somit dann ausgeführt werden kann.
Das Design des Erwarteten Assembly codes ist in design.txt
beschrieben
English
Assembler
CLI application written in C
The assembler converts the written assembly into a memory image for the EIPA processor. This memory image then contains the instructions in as machiene code which is readable by the EIPA processor
It is basically made up of 4 building blocks:
1. lexer
The lexer takes the file with the written assembly and converts it into the individual components (tokens). It also takes into account if, for example, there are multiple spaces between the parts of the instruction, so that the other parts of the assembler do not have to worry about that. It converts e.g. the line INP 31 ; A comment into the parts |INP|, |31|, |end of instruction|.
2. error analyzer
The error analyzer takes the tokens from the lexer, and checks e.g. if the address of an instruction is too large, if an instruction that needs an address has one, if there are any typos, etc. If it finds an error, it aborts the program.
3. target code generator
The target code generator converts the tokens from the lexer, after checking them for errors, into machine code readable by the EIPA processor.
4. image saver
The image saver stores the generated machine code in an EIPA memory image, which can then be loaded into memory by the processor and executed.
The design of the expected assembly code is described in design.txt
.