Sunday, October 6, 2013

Constant Number Dictionary

The information template dictionary will be used for the constant number dictionary.  The additional information will hold the double and integer value of the constant, and is obtained from the same members in the token.  Even through for double constants that can't be converted to an integer, the integer value (which is not set) is still copied to the information element, but it won't actually be used at run-time.

A constant number information class was defined containing the double and integer values.  This class was given a blank default constructor (required for the QVector class), and a constructor taking a token pointer to initialize the values (required for the information template dictionary).

To complete the implementation, a constant number dictionary was added to the program unit with allocation and an access function.  The constant number encode and operand text routines were added that simply call the dictionary add and string routines.  Finally, pointers to these functions were added to the associated table entries.  The expected results file for encoder test #1 was updated for the numeric constants that are now in the output.

[commit babfb758ec]

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.)