Imbastardizer is a source preprocessor for old dialects of BASIC.
Imbastardizer is written in Vimscript and can be executed on Vim and Neovim.
Imbastardizer started in 2016-12 as an improved replacement for previous tools developed by the author for some dialects of BASIC:
- BBim for Beta BASIC (ZX Spectrum)
- MBim for MasterBASIC (SAM Coupé)
- SBim for SuperBASIC (Sinclair QL's QDOS) and SBASIC (SMSQ/E)
- Vimclair BASIC for Sinclair BASIC (ZX Spectrum)
The goal of Imbastardizer was to replace them all and select the target with a directive. Nevertheless, the initial targets were GW-BASIC and MSX-BASIC.
In 2016-12/2017-07 Imbastardizer was heavily tested during the development of a GW-BASIC text-based game for the PC-BASIC emulator. When the project changed its target platform the development of Imbastardizer stagned. Besides, although it worked great, extending some features, especially the control structures and the pseudo-procedures, to support more target dialects of BASIC seemed too complex for the small benefit.
In 2021-04 the need for a generic but simpler source preprocessor arised during the development of a project in ZX Spectrum Next's NextBASIC, and rewritting Imbastardizer with a new, much simpler approach before version 1.0.0 seemed the best option. Finally Imbastardizer became unnecessary and was abandoned.
- C-style block and line comments.
- Shell-style line comments.
- Splitted lines.
- Labels instead of line numbers.
#vimdirective to execute any Vim command in the source.#include,#define,#ifdef,#ifndefand others.- Long variable names using the
#vimdirective to make the substitutions. - Control structures (can be nested):
DO ... LOOPDO ... LOOP UNTILDO ... LOOP WHILEDO UNTIL... LOOPDO UNTIL ... LOOP UNTILDO UNTIL ... LOOP WHILEDO WHILE ... LOOPDO WHILE ... LOOP UNTILDO WHILE ... LOOP WHILEEXIT DOEXIT FORIF ... THEN ... ENDIFIF ... THEN ... ELSE ... ENDIFIF ... THEN ... ELSE IF ... ELSE ... ENDIF(with any number ofELSE IF)
- Procedures (without parameters):
DEF PROC,END PROC,EXIT PROC,CALL. - Procedures with parameters can be simulated ad hoc with the
#vimdirective. - The
CALLcommand can be changed with#procedureCall, e.g.:#procedureCall procor even make it empty:#procedureCall.
- Labels instead of line numbers.
#define.#include.
To install Imbastardizer, copy "imbastardizer.vim" to the "~/.vim" directory.
Then the program can be executed with Vim's runtime command.
Example of a "Makefile" rule that preprocess a BASIC source file with Imbastardizer:
src/%.bas: target/%.bas
@vim -e -R \
-c "runtime imbastardizer.vim" \
-c "saveas! $@|q!" $<
- 2021-04-08: the Git repository was converted to Fossil, but keeping GitHub as a mirror.
- 2023-04-05: the Fossil repository was converted to Mercurial, enabling better interaction with GitHub.
- 2025-02-23: the Mercurial repository was uploaded to SourceHut, keeping GitHub as a mirror.