40 lines
1.9 KiB
Markdown
40 lines
1.9 KiB
Markdown
# LVTL-X: a compact and fair VTL-2 port to POSIX AWK
|
|||
|
|
|
||
|
|
## About
|
||
|
|
|
||
|
|
LVTL-X is a port of the [VTL-2](https://rosettacode.org/wiki/Category:VTL-2) retro programming language interpreter to the POSIX AWK runtime. Unlike the previous effort, LVTL-W, that only worked in BusyBox and GAWK, this version works in any POSIX-compliant environment. On top of that, LVTL-X is extremely compact and takes under 100 SLOC of portable and readable AWK code.
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
The easiest way is to run the `./lvtl` shell wrapper, either stand-alone or with a program file path to preload. You can also specify a non-default AWK interpreter to use with the `AWK` environment variable for the wrapper to use.
|
||
|
|
|
||
|
|
Alternatively, you can run the LVTL-X script directly like this:
|
||
|
|
|
||
|
|
```sh
|
||
|
|
POSIXLY_CORRECT=1 awk -f lvtl-x.awk -- [/path/to/your/vtl/program.vtl] -
|
||
|
|
```
|
||
|
|
|
||
|
|
If running without a wrapper and specifying a program to preload, don't forget to put another `-` after it.
|
||
|
|
|
||
|
|
## Differences from the Altair original
|
||
|
|
|
||
|
|
LVTL-X stands out from other LVTL versions by being closer to the original VTL-2, but still has some important differences that shouldn't be ignored:
|
||
|
|
|
||
|
|
- both LF and CRLF are accepted (but not saved into RAM)
|
||
|
|
- only LFs are printed instead of CRLFs
|
||
|
|
- maximum line length is not enforced
|
||
|
|
- all whitespace after the line number is fully ignored
|
||
|
|
- any whitespace within expressions is also insignificant
|
||
|
|
- parentheses are NOT auto-closed at the end of the statement
|
||
|
|
- only 26 characters (A-Z) are valid generic variable names
|
||
|
|
- supports all standard VTL-2 binary operators: +, -, *, /, =, >, <
|
||
|
|
- jumps to itself (like 10 #=10) are prohibited and counted as nops
|
||
|
|
- no file I/O (only the option to preload VTL code from a file)
|
||
|
|
- self-modifying programs won't work correctly
|
||
|
|
|
||
|
|
Nevertheless, any program that's valid on LVTL-X will run on the original VTL-2/02 implementations too.
|
||
|
|
|
||
|
|
## Credits
|
||
|
|
|
||
|
|
Created by Luxferre in 2026, released into the public domain with no warranties.
|