Package com.scriptbasic.interfaces
Interface BuildableProgram
-
- All Superinterfaces:
Program
- All Known Implementing Classes:
AbstractBasicProgramPostprocessing,BasicProgram
public interface BuildableProgram extends Program
ABuildableProgramis aProgramthat also provides methods needed to build up the program code during the BASIC source code analysis.- Author:
- Peter Verhas date June 15, 2012
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddCommand(Command command)Add a new command to the list of commands.voidpostprocess()Calling this method signals that all the commands are added to the program.voidreset()Calling this method will remove all previously built code from the program.-
Methods inherited from interface com.scriptbasic.interfaces.Program
getCommands, getNamedCommand, getNamedCommandNames, getStartCommand
-
-
-
-
Method Detail
-
reset
void reset()
Calling this method will remove all previously built code from the program. This method should be called if the sameBuildableProgramobject 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 AnalysisExceptionCalling 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
-
-