Before beginning the implementation of the LET command translation routine, so thought was given on how the project should be organized. The old token centric translator design had the translation of commands embedded throughout the translator, specifically in the token handling functions. With the new translator design being command centric, the various routines (translate, recreate and execute) for each command can be organized into their own files.
A decision was also made not to clutter up the main project directory with all the various command source files, so these files will be put into a sub-directory. The name "basic" was chosen for this sub-directory since all the sources files will be related to the BASIC language. This sub-directory will also contain the execute routines for all of the operators and internal functions of the BASIC language. The various command function prototypes (and any other command related definitions needed) will be put into the commands.h header file in this sub-directory.
The let.cpp source file was created in the basic sub-directory to hold LET command routines. An initial translate routine was implemented for the LET command. For now, this routine just checks if the LET keyword was specified and returns two different BUG Debug statuses to distinguish between the two forms. Finally, a function prototype for this routine was added to the commands.h header file.
Some changes were also needed to the CMake build configuration file starting with added the let.cpp source file to the list of source files. So that the various files in the basic sub-directory can access the various header files, the main project source directory was added to the list of include directories. It turns out that it is not necessary to make the executable dependent on the list of project header files as CMake automatically figures out all the dependent header files for each source file, so this list was removed.
The initial LET function was tested with translator test #5 (LET command tests) to make sure the temporary BUG Debug errors were reported correctly.
[commit 3330b28c9e]
Subscribe to:
Post Comments (Atom)
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.)