# SIC - README
###### tags: `大二下` `系統程式`
There are two passes of my C program.
---
### Data
* Input data:
* opcode.txt
>It's is a txt of opcode
>This is a part of **opcode.txt**
>
>.
>.
>.
* sic.txt
>This is the source input
>This is a part of **sic.txt**
>
>.
>.
>.
* Output file:
* pass1_source_program.txt
>This one is the file of source with addind the **location** column
* symbol_table.txt
>This is the **symbol table** generate as pass1 finish
* pass2_source_program.txt
>This is the file of source with addind the **location** and **object code** column
* object_program.txt
>This is the final program which can be run as a machine code,and also the **answer**
---
### Operation method
1. Open the **SIC.c** in my file
2. It will generate **four '.txt'**
3. Check it and you will find they are correct!
---
### About the program logic
Use two struct to build **opcode** and **symbol table's** structs
* opcode
* save opcode
>easily to check the number of opcode
>
* pass1
* Use ***data structure*** - stack
>
>
In pass1:
->first open file sic.txt
->use the **opcode table**
->while making a symbol table,it need to check the location
->and then,generate **pass1_source_program.txt**
->after,the symbol table will be built with their loction was known
* pass2
* Use ***data structure*** - queue
>
>
In pass2:
->first calculate the **object code** of each line
->and then,generate **pass2_source_program.txt**
->finally,**object_program** generated