Imbastardizer is a source preprocessor, especially suited for old or limited dialects of BASIC.
It's written in Vim Script, and can be executed on Vim or Neovim.
Planned for version 1.0.0:
#define
, #ifdef
, #ifndef
directives.#vim
directive to execute any Vim command in the source.The previous version 0.4.2 had many more features and a different approach.
At the time of writing (2021-04) Imbastardizer is being rewritten to prepare version 1.0.0.
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!" $<
Imbastardizer started in 2016-12, as an improved replacement for previous tools developed by the author for one specific dialect of BASIC:
The goal of Imbastardizer was to replace them all and select the target with a directive. Anyway, the initial targets were new: GW-BASIC and MSX-BASIC.
The supported features were the following:
#vim
directive to execute any Vim command in the source.#include
, #define
, #ifdef
, #ifndef
and others.#vim
directive to make the
substitutions.DO ... LOOP
DO ... LOOP UNTIL
DO ... LOOP WHILE
DO UNTIL... LOOP
DO UNTIL ... LOOP UNTIL
DO UNTIL ... LOOP WHILE
DO WHILE ... LOOP
DO WHILE ... LOOP UNTIL
DO WHILE ... LOOP WHILE
EXIT DO
EXIT FOR
IF ... THEN ... ENDIF
IF ... THEN ... ELSE ... ENDIF
IF ... THEN ... ELSE IF ... ELSE ... ENDIF
(with any number of
ELSE IF
)DEF PROC
, END PROC
, EXIT
PROC
, CALL
.#vim
directive.CALL
command can be changed with #procedureCall
, e.g.:
#procedureCall proc
or even make it empty: #procedureCall
.In 2016-12..2017-07 Imbastardizer was heavily tested during the development of the CE4 project in GW-BASIC for the PC-BASIC emulator.
Then the CE4 project changed its target platform and 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 the CE4 project in NextBASIC, and rewritting Imbastardizer with a new approach seemed the best option.
In order to resume the development of Imbastardizer, its Git repository was converted to Fossil, but keeping GitHub as a mirror. The latest version was tagged as v0.4.2.