![]() | ![]() | ![]() | ![]() | |
![]() | A more detailed description for the major classes: | |||
![]() | ||||
![]() |
| |||
![]() | ||||
![]() | This class is the most important component of the compiler; There are three public methods: - Compile, accepts the file to be compiled in input and returns a boolean value specifying if the compilation step has finished successfully. The first action done by this method is to add to the symbol table the reserved variables and functions by compiling the file "dc3res.vb" (every reserved declaration has the access modifier 'Reserved'). Then the main program is compiled and the 'Reserved' word cannot be used anymore. Every time an error is encountered a cCompilerError is raised. It is strictly related to the BNF grammar written to the file "dc3.grm". - GetByteCode, returns the resulting byte code - GetSymbTable, returns the obtained Symbol Table (only for debug purposes) | |||
![]() | ||||
![]() |
| |||
![]() | It is simply a collection of cSymbTableEl elements plus some methods for getting and setting elements. Contains every declared function and variable with relative informations. | |||
![]() | ||||
![]() |
| |||
![]() | ||||
![]() | A symbol table element has a unique Name, a Type (variable, constant, function, sub) and an Access Modifier (public, private, reserved). If the element is a sub or a function it has also a cFuncInfos information that contains a local symbol table for the function, a list of parameters and the address where the function is, in the generated bytecode. | |||
![]() | ||||
![]() |
| |||
![]() | ||||
![]() | It contains the program instructions. See the list here. | |||
![]() | ||||
![]() |
| |||
![]() | ||||
![]() | It executes the resulting ByteCode using two cStacks (the addresses stack and the variables stack), a cRunTimeError, raised when some errors happen, a Program Counter (PC) information that represents the current instruction to be executed and a Base Pointer (BP) that represents the pointer to local variables into the stack. The working model of this class is very similar to a real Personal Computer. |