BASIC Compiler Source Code

The following software is © D L BIRD 2007 – You can use it in your projects if you recognise me as the author.

I wrote this compiler in PASCAL and it will compile BASIC programs written in PIC BASIC dialect, producing a pseudo-code output which then needs to be assembled by the MICROCHIP assembler.

Also included is a test program which is designed to exercise the compiler through all its constructs and ensure the parser operates correctly, including arithmetic precedence rules.

The code can easily be converted to VBASIC and then extended with new functions as required. If you know what your doing; and not many people do, you can easily get it working.

The link library functions have been retained by me, because if you do know how a compiler operates and is designed, you can easily create these for your target CPU.

The complier uses an intermediate language (P-Code) which is readable to assist with debugging. Unlike many BASIC compilers for the PIC Chip, this one produces nature code and does not require an Interpreter to be running (and slowing down execution speed).

Here is the source code (in PDF format) of the compiler: BASIC_COMPILER_SOURCE CODE