Preprocessor for MCS-52 BASIC
One "Circuit Cellar" Project printed in the "Byte" Magazine covered the Intel 8052AH microcontroller, which has an on-board basic interpreter. After some tinkering, I decided to support my own SW development by writing a small Preprocessor which helped in detecting "obvious" errors like spelling mistakes and the like.
I designed an "extended" syntax which introduced variable and label declarations, import declarations for global variables being used in subroutines and scope rules.
All these syntax-elements were implemented as Basic "REM" statementent to allow a program writtten in "extended syntax" to be compatible with the 8052 microprocesor without any need for editing.
BASCOM is a parser and syntax checker building/referencing a symbol table
Rem VAR varname defines a variable with a multi-charatcer name
Rem VAR [size] varname defines an array with a multi-charatcer name
Rem VARDEL varname deletes the definition i.e. disallows usage of variable "varname"
Rem IMPORT varname allows usage of a variable within a GOSUB subroutine
Rem EndImport disallows usage of a variable within a GOSUB subroutine
This helped tremendously in making the Basic code more reliable.
TP 5.5 Source code