Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oguzhand95/tis100
A tool and package to parse TIS100 assembly programs.
https://github.com/oguzhand95/tis100
assembly golang parser tis100
Last synced: 24 days ago
JSON representation
A tool and package to parse TIS100 assembly programs.
- Host: GitHub
- URL: https://github.com/oguzhand95/tis100
- Owner: oguzhand95
- License: apache-2.0
- Created: 2022-08-25T18:34:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-28T18:03:56.000Z (about 2 years ago)
- Last Synced: 2024-06-21T13:08:15.178Z (5 months ago)
- Topics: assembly, golang, parser, tis100
- Language: Go
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TIS100
A tool and package to parse TIS100 assembly programs.
## CLI Usage
### Command `tis100 parse `
Parses the TIS100 assembly program in the given ``, and prints the AST result into standard output.
```
MOV 10, ACC
MOV ACC, DOWN
``````bash
-> tis100 parse ~/program.asm
```The result for the above execution looks like this;
```yaml
instructions:
- mov:
source:
literal: 10
destination:
register: ACC
- mov:
source:
register: ACC
destination:
register: DOWN
```## Package Usage
```bash
go get github.com/oguzhand95/tis100
``````go
import "github.com/oguzhand95/tis100/parser"func main() {
b, err := os.ReadFile(c.Path)
if err != nil {
return fmt.Errorf("failed to open the file in path %s: %w", c.Path, err)
}ast, err := parser.Parse(bytes.NewReader(b), filepath.Base(c.Path))
if err != nil {
return fmt.Errorf("failed to parse the program: %w", err)
}
// Use ast struct to do some stuff
}
```# Thanks
- Thanks [Zachtronics](https://www.zachtronics.com/) for developing this awesome [puzzle game](https://store.steampowered.com/app/370360/TIS100/)!