Interface BuildableProgram

All Superinterfaces:
Program
All Known Implementing Classes:
AbstractBasicProgramPostprocessing, BasicProgram

public interface BuildableProgram
extends Program
A BuildableProgram is a Program that also provides methods needed to build up the program code during the BASIC source code analysis.
Author:
Peter Verhas date June 15, 2012
  • Method Details

    • reset

      void reset()
      Calling this method will remove all previously built code from the program. This method should be called if the same BuildableProgram object is used to execute different programs, one after the other.

      Without calling this method the program would be concatenated and the second execution would contain the program codes of the first program and after that the second.

    • addCommand

      void addCommand​(Command command)
      Add a new command to the list of commands.
      Parameters:
      command - parameter
    • postprocess

      void postprocess() throws AnalysisException
      Calling this method signals that all the commands are added to the program. This method has to perform all the polishing of the built program that are to be done after the commands are analyzed. These include:
      • optimizing expressions
      • recalculating if/elseif/else/endif jumps
      • building subroutine symbol table
      • checking syntax analysis rules that apply to the whole program and are easier to implement this way than keeping different state informations during the syntax analysis, which is line oriented. For example checking that all LOCAL and GLOBAL declarations in a SUB are before any executable statement, subs are not nested...
      Throws:
      AnalysisException - when the postprocessing discovers syntax errors