Tuesday, October 1, 2013

Program Components And Organization

The dictionaries are needed for the next step of the encoder to be implemented, which means that the encoder needs access to the dictionaries.  Temporary dictionaries could be implemented in the tester class and maid available to its encoder instance.  Eventually though, the program model will be the owner of the dictionaries.  Some design was needed for what components the program model will contain for a program.  The current plan follows...

The program will be organized into program units.  The program model will contain a list of program units.  Each unit will represent the main routine (only one), a subroutine (zero or more) or a function (zero or more) and will contain these components (only the main routine program unit with the components in bold are being implemented at this time):
  • Name (only subroutine and function program units)
  • ID - index within the program unit list (main routine will be the first)
  • Code - array of program words
  • Line Information - information about each line in the program
  • Block Information - information about multi-line statements (IF, FOR, etc.)
  • Remark Dictionary
  • Number Constant Dictionary
  • String Constant Dictionary
  • Subroutine Dictionary
  • Function Dictionary
  • Common Variable Dictionary
  • Common Array Dictionary
  • Common Define Function Dictionary
  • Variable Dictionary
  • Array Dictionary
  • Define Function Dictionary
  • Argument Dictionary (only subroutine and function program units)
  • Return Value (only function program units)
There will be only one instance of the italicized components, which will belong to the main routine program unit, but each of the subroutine and function program units will contain a pointer to these dictionaries.  The common dictionaries are for COMMON statements, which will indicate variables, arrays, or defined functions that are accessible outside a given program unit (similar to C/C++ global variables).  Further details of each component will be described as each is implemented.

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)