uxnlin/README.md

53 lines
1.5 KiB
Markdown
Raw Normal View History

2021-08-23 02:09:27 +01:00
# Uxnlin
2022-05-26 23:11:50 +01:00
A linter for the Uxntal programming language, written in [Uxntal](https://wiki.xxiivv.com/site/uxntal.html).
2021-08-23 02:09:27 +01:00
2022-05-26 23:11:50 +01:00
## Build
2021-08-23 02:09:27 +01:00
2022-05-26 23:11:50 +01:00
You must have the [Uxn](https://git.sr.ht/~rabbits/uxn/) assembler and emulator.
2021-08-23 02:09:27 +01:00
2022-09-04 19:45:19 +01:00
```sh
uxnasm src/uxnlin.tal bin/uxnlin.rom
```
2022-05-27 15:44:01 +01:00
## Usage
2021-08-23 02:09:27 +01:00
The following command will read a `tal` file and raise warnings if optimizations can be found.
2022-07-07 17:54:10 +01:00
```sh
2022-05-26 23:11:50 +01:00
uxncli bin/uxnlin.rom path/to/source.tal
2021-08-23 02:09:27 +01:00
```
2022-07-07 17:54:10 +01:00
If do not wish to assemble it yourself, you can download [uxnlin.rom](https://rabbits.srht.site/uxnlin/uxnlin.rom).
2022-11-11 23:44:50 +00:00
[![builds.sr.ht status](https://builds.sr.ht/~rabbits/uxnlin.svg)](https://builds.sr.ht/~rabbits/uxnlin?)
2022-05-27 15:44:01 +01:00
## Manual
- Skip sections of code by wrapping them inside square brakets.
2022-05-27 02:46:56 +01:00
```
2022-07-07 18:13:57 +01:00
#01 #02 ADD ( will throw a warning )
[ #0001 #0002 ADD2 ] ( will not throw a warning )
2022-05-27 02:46:56 +01:00
```
2022-09-04 19:45:19 +01:00
### 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.
2022-07-07 18:12:22 +01:00
### Warnings
- `Redundance`: Opcode effects cancel each other.
- `Static-Arithmetic`: Arithmetic opcode on two static literals.
2022-07-10 22:03:57 +01:00
- `Static-Duplicate`: Two identical static literals.
2022-07-07 18:12:22 +01:00
- `Unkept`: Opcode should use non-destructive keep mode.
- `Unsafe`: Bitwise opcode used in relative jump.
- `Unstashed`: literal was created on the wrong stack.
2022-05-26 23:11:50 +01:00
## Extras
2021-08-23 02:09:27 +01:00
2022-05-26 23:11:50 +01:00
- [Need a hand?](https://llllllll.co/t/uxn-virtual-computer/46103)
2022-08-09 12:00:07 +01:00
- Linted with [uxnlin](https://git.sr.ht/~rabbits/uxnlin)
- Assembled with [drifblim](https://git.sr.ht/~rabbits/drifblim)