This is a simple project that check for syntax errors in your SiCoMe program.
You can see this project also in Crates.io
You must have Rust installed:
cargo install sicompiler To use sicompiler you need to have a .txt file where you write your program and a .rep file with the valid instructions.
sicompiler --rep <REPERTOIRE_PATH> <INPUT_PATH> <INPUT_PATH> The input path to compile <REPERTOIRE_PATH> The repertoire of instructions [OUTPUT_PATH] The output path to write to [default: out.txt] -o, --out <OUTPUT_PATH> The output path to write to [default: out.txt] -r, --rep <REPERTOIRE_PATH> The repertoire of instructions -h, --help Print help -V, --version Print version The result will be an output file with the path you write or a default path in the same directory you are.
0 0003 #Number 1 1 0003 #Number 2 3 0000 #Result *** This is a multi-line comment *** @ 6 @ CRA CRF ADD 0001 ROR_F_ACC SFZ JMP 12 #F!=0 #-----F==0----- CRA CRF ADD 0000 ROL_F_ACC STA 0004 HALT #-----F!=0----- CRA CRF ADD 0001 ROL_F_ACC STA 0004 HALT 0 0003 1 0003 3 0000 @ 6 @ CRA CRF ADD 0001 ROR_F_ACC SFZ JMP 12 CRA CRF ADD 0000 ROL_F_ACC STA 0004 HALT CRA CRF ADD 0001 ROL_F_ACC STA 0004 HALT Important
These standards are subject to updates.
This compiler meets some standars that have been written resently.
The comments in one line will be specified by a #:
CRA 23 #One line comment The comments in one line will be specified by *** at the beginig and another at the end:
CRA 23 ***Multi line comment*** A program is divided into three clearly differentiated sections, each of them separated by the @ character.
<variables declaration> @ <start dir> @ <sentences> A repertoire of instructions is the set of instructions that can be in the SiCoMe program.
The structure of a repertoire is like this:
$ <microprogram section> (Not implemented) $ <valid instructions> - The program does not follow the structure defined by the standard.
- The instructions in the program are not defined in the repertoire.
- The instructions does not have the correct number of parameters.
- The parameters of the instructions are not in hex base.
If you want to colaborate and add new features to the project you must do this simples steps.
git clone git@github.com:Pacatro/sicompiler.git cd sicompiler cargo buildThere are unit tests for the principals structs Tokenizer and Validator and only two integration tests.
To execute tests you only need to run the following command:
cargo testMIT - Created by P4k0.