Merge local changes with the ones done from the git viewer

Merge branch 'main' of https://h2939863.stratoserver.net/git/EIPA/Assembler
This commit is contained in:
XOR 2023-04-13 06:36:19 +02:00
commit a1c42a4baa
3 changed files with 4 additions and 16 deletions

View file

@ -6,8 +6,8 @@ The assembler converts the written assembly into a memory image for the EIPA pro
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|.
`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.

View file

@ -1,11 +1,2 @@
#Convert tokens to Machiene code
Check for Errors in the EIPA Assembly (using the tokens)
#Save Machiene code in a file
#Add command line options
#COMMENTS!
function return errors + handling of those
Consider what happens when the input file contains too many instructions or one token is too long
Do some "skip over" loops in lexer need a check for EOF?
Consider using a hashtable for the token array to eliminate the if else ladder in get_target_code
Moved to
https://gabby-goose-5bd.notion.site/1118d9c2fd87412b8710656d17dcd32c?v=cc164a067eb24bbf94024865970e9337

View file

@ -28,9 +28,6 @@ int save_img(char *out_path, __uint32_t *target_code){
FILE *out_file = fopen(out_path, "wb");
if(out_file == NULL) return EIO;
// Count instructions
if (fwrite(target_code, sizeof(target_code), count, out_file) != count)
{
// Couldn't save the image