Skip to content
This repository was archived by the owner on Apr 7, 2024. It is now read-only.

amaank404/sas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e97fc0a Β· Apr 7, 2024

History

32 Commits
Nov 11, 2022
Nov 13, 2022
Nov 13, 2022
Nov 13, 2022
Nov 13, 2022
Nov 15, 2022
Apr 7, 2024
Nov 11, 2022
Nov 11, 2022
Nov 13, 2022

Repository files navigation

Abandoned!

This project has been abandoned, you are free to use the specs as you wish :P but the compiler and emulator are not guarenteed to work.

LOGO Image

SAS (Small and Simple) πŸ˜„

Sas is a cpu architecture that was just created for emulators and other such stuff. It is for fun and for learning basic assembly language. You can look at specs for more information.

Features 🌟

  • 32-bit architecture πŸ“Ÿ
  • Easy to use πŸŽ‰
  • Less than 25 instructions to grasp πŸ“ƒ
  • Easy to debug πŸ›
  • Fast and extensible emulator ⚑

Compiler/Decompiler

The compiler is itself written in nim and the code is organized using modules. Your main interest should be at module sas/toolchain/parser. To compile a source file. You should follow the following series in order. The result of one to the other in chain:

  • parseAsm
  • resolveIncludeDirectives
  • compile

And to decompile you can use the following function

  • decompile

To convert debuginfo from table to string. There are exported functions that are originally located in sas/toolchain/debuginfo.

  • fromTextDebugInfo
  • toTextDebugInfo

CLI πŸ’»

This compiler also provides a commandline interface. First, build the main binary by using nimble -d:release build. This should build the sas binary which you can invoke by ./sas --help. The CLI interface is full featured.

Compiler Compilation Flags 🎌

The compiler has some flags that alter the output binary.

Flag Effect
-d:release Makes the compiler very fast ⚑
--mm:orc --deepcopy:on Makes the compiler even faster ⚑⚑
-d:hideWarnings Resulting compiler will never have any warnings enabled ⚠️

Running the tests

This project comes with a test suite, any contributions made require a test to be written, as of now these work by using the tool testament. To run these tests you can run the following command:

testament cat .

Specs πŸ“’

To basically learn about SAS, please look into specs. They contain every detail. Even a reference

Licensing πŸ“„

LICENSED UNDER MIT LICENSE. LOOK AT LICENSE FILE FOR MORE DETAILS