mirror of https://git.sr.ht/~rabbits/uxnlin
53 lines
1.5 KiB
Markdown
53 lines
1.5 KiB
Markdown
# Uxnlin
|
|
|
|
A linter for the Uxntal programming language, written in [Uxntal](https://wiki.xxiivv.com/site/uxntal.html).
|
|
|
|
## Build
|
|
|
|
You must have the [Uxn](https://git.sr.ht/~rabbits/uxn/) assembler and emulator.
|
|
|
|
```sh
|
|
uxnasm src/uxnlin.tal bin/uxnlin.rom
|
|
```
|
|
|
|
## Usage
|
|
|
|
The following command will read a `tal` file and raise warnings if optimizations can be found.
|
|
|
|
```sh
|
|
uxncli bin/uxnlin.rom path/to/source.tal
|
|
```
|
|
|
|
If do not wish to assemble it yourself, you can download [uxnlin.rom](https://rabbits.srht.site/uxnlin/uxnlin.rom).
|
|
|
|
[![builds.sr.ht status](https://builds.sr.ht/~rabbits/uxnlin.svg)](https://builds.sr.ht/~rabbits/uxnlin?)
|
|
|
|
## Manual
|
|
|
|
- Skip sections of code by wrapping them inside square brakets.
|
|
|
|
```
|
|
#01 #02 ADD ( will throw a warning )
|
|
[ #0001 #0002 ADD2 ] ( will not throw a warning )
|
|
```
|
|
|
|
### Includes
|
|
|
|
When Uxnlin encounters an include rune, such as `~src/include.tal`, the parser will move on to evaluating the file without coming back.
|
|
This is designed to follow Drifblim's include chain pattern.
|
|
|
|
### Warnings
|
|
|
|
- `Redundance`: Opcode effects cancel each other.
|
|
- `Static-Arithmetic`: Arithmetic opcode on two static literals.
|
|
- `Static-Duplicate`: Two identical static literals.
|
|
- `Unkept`: Opcode should use non-destructive keep mode.
|
|
- `Unsafe`: Bitwise opcode used in relative jump.
|
|
- `Unstashed`: literal was created on the wrong stack.
|
|
|
|
## Extras
|
|
|
|
- [Need a hand?](https://llllllll.co/t/uxn-virtual-computer/46103)
|
|
- Linted with [uxnlin](https://git.sr.ht/~rabbits/uxnlin)
|
|
- Assembled with [drifblim](https://git.sr.ht/~rabbits/drifblim)
|