Sunday, June 19, 2016

New Direction (this project is not dead)

Starting from scratch (well almost)...

The code for this project has become rather complex with three major problems, the translation process, the testing process and the GUI text widget.  The later has numerous problems with undo and redo where the edit windows gets out of sync with the program code.  This undo/redo issue will be put on the back burner for now.

The complicated translation process is the major issue.  The code has become rather confusing (due in part to large and difficult to understand functions).  The code desperately needs to be refactored (cleaned-up).  In the year plus away from this project, a new simpler method of conversion from source code to internal executable code has been conceived.

The other major issue is the testing process.  Test routines are built into the program itself and activated with special command line options.  Running the tests involve feeding in pre-built text files and comparing the output to expected pre-built text files.  This was made to work, though the process is rather complicated and is problematic on Windows from a command windows (DOS prompt).  This process needs to be replaced with proper unit tests that are separate from the main program.

New Project - IBCX

A new project has been started - the Incremental BASIC Compiler Experiment (IBCX), which will research this new idea for the conversion of source code.  Essentially, it appears possible to convert source code directly to internal code without going through the intermediate steps of parsing (tokenization), translation (to a reverse Polish format), and encoding (to internal code).

The Test Driven Development (TDD) process is being used with unit tests.  A new repository has been created on GitHub for this.  Unlike for the IBCP, regular posts to a blog are not being made as development continued as this only inhibited progress.  The commit log entries will serve this purpose.  There is a wiki on GitHub that is being utilized for information about the IBCX project, which will slowly be expanded.  The main page contains the current status of the IBCX project.

For this new project, the primary code is build into a library.  The intention is that this library can be utilized by a separate GUI application (like what was built for the IBCP).  Currently the library supports a simple PRINT statement (of either a blank line of a single expression), and an END command.  The expressions so far support numerical constants, and the negate operator with work proceeding with the exponential operator.

A very primitive compiler application has been implemented utilizing this library.   This compiler will compile a program in a file (consisting of the simple items implemented so far) and run the program.  There is also an option to recreate the program into the original source.