<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7660361599834253025</id><updated>2011-10-11T21:28:19.530-04:00</updated><category term='Pre-Release'/><category term='Hidden Codes'/><category term='Internal Code'/><category term='Table'/><category term='Release'/><category term='Language'/><category term='Execution'/><category term='Project'/><category term='Parser'/><category term='Blocking'/><category term='Memory Leaks'/><category term='NetBeans'/><category term='Input Command'/><category term='Strings'/><category term='Lists'/><category term='Testing'/><category term='Translator'/><category term='Expression Type'/><title type='text'>Interactive BASIC Compiler Project</title><subtitle type='html'>The purpose of this blog is to document the effort to create an interactive BASIC compiler.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default?start-index=101&amp;max-results=100'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>318</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8360016723564919983</id><published>2011-06-25T10:16:00.000-04:00</published><updated>2011-06-25T10:16:23.225-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Switch in Linux Distribution</title><content type='html'>The 64-bit Kubuntu 10.10 installation has been problematic. Several comments around the Internet have indicated this to be the case. The reason Kubuntu was chosen was that it contained the KDE desktop, and 10.10 was chosen because of it is the newest on the supported host operating system list for VMWare Workstation (being used for the Windows XP virtual machine). Standard Ubuntu comes with the GNome interface, which I am not a fan of.&lt;br /&gt;&lt;br /&gt;The problems with Kubuntu mainly include general sluggishness, a problem that was never resolved after a little over a month of use (something not expected on a Phenom II quad code running at 3.2 GHz with 4GB of memory with a NDIVIA GTS-450). It would completely hose up at times (not lock up or crash) when doing even simple tasks like uncompressing files. Even after all the updates were applied (less the update to 11.04 Natty Narwhal), including KDE and all the fancy desktop effects were turned off, the problems persisted. Mounting a bunch of NTFS partitions (from the previous Windows XP installation) was also suspected to be a cause.&lt;br /&gt;&lt;br /&gt;Therefore, the Linux Mint 10 (Julia) with KDE distribution, which is also based on Ubuntu 10.10 (Maverick Meerkat) was chosen for the next installation. Linux Mint is another distribution based on Ubuntu/Debian. All the various commands mentioned in previous posts for Kubuntu also apply to Mint.&lt;br /&gt;&lt;br /&gt;However, several issues were discovered in the various required tools that were not mentioned previously. There are some additional packages required for building GCC 4.6.0 and its prerequisite libraries (the GNU autotools) and for building CMake (specifically the ccmake GUI). The &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2011/06/linker-problem-on-linux.html"&gt;Linker Problem on Linux&lt;/a&gt; and &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2011/06/new-make-system.html"&gt;New Make System&lt;/a&gt; posts were updated with new information about these dependencies. After a day of using Linux Mint 10, it is running as expected for a modern operating system on a fairly decent (though not cutting edge) system.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8360016723564919983?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8360016723564919983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/switch-in-linux-distribution.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8360016723564919983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8360016723564919983'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/switch-in-linux-distribution.html' title='Switch in Linux Distribution'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5349004311037733266</id><published>2011-06-23T22:49:00.000-04:00</published><updated>2011-06-23T22:49:37.118-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Using CMAKE on Windows</title><content type='html'>The latest version of CMAKE (2.8.4) for Windows was installed, which can be obtained from &lt;a href="http://www.cmake.org/cmake/resources/software.html"&gt;here&lt;/a&gt; (the Win32 Installer). The same version used on Kubuntu 10.10. On Windows, there is a CMAKE (cmake-gui) program installed in the CMake 2.8 start menu group and it took some effort to figure out how to use it. Here is the procedure for building the program, starting in the CMAKE (cmake-gui):&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Select "Browse Source..." and point to where the source is&lt;/li&gt;&lt;li&gt;Select "Browse Build..." and point to where the build will be (which should not be the source directory)&lt;/li&gt;&lt;li&gt;Optionally there is a "Make New Directory" to create a "build" directory&lt;/li&gt;&lt;li&gt;The next step is to select the "Configure" button, however, if the "Current Generator:" does not say "None" then select File/Delete Cache to make it change to None.&lt;/li&gt;&lt;/ol&gt;Before doing these steps, CMAKE needs to be able to find the GCC compilers and other tools. The Windows environment variable PATH needs to be modified, which can be done by inserting "&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C:\MinGW\bin;C:\MinGW\msys\1.0\bin;&lt;/span&gt;" at the beginning of PATH (assuming the default directories were used in the MinGW installer). Upon selecting "Configure" in Step 4, CMAKE will pop up a dialog. Change the generator for the project to "MSYS Makefiles" and select the "Finish" button. If all goes well, some lines will be output in the bottom section with no errors (errors are output in red text).&lt;br /&gt;&lt;br /&gt;Now select "Generate" and the make file will be created. In an MSYS window, change to the build directory and do a "make" command. The program should now be built. All the generated files will be in the build directory including the executable, the auto-generated header files and the codes.txt file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5349004311037733266?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5349004311037733266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/using-cmake-on-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5349004311037733266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5349004311037733266'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/using-cmake-on-windows.html' title='Using CMAKE on Windows'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8740976199763666460</id><published>2011-06-21T23:19:00.001-04:00</published><updated>2011-06-21T23:20:21.120-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Using the CMake System</title><content type='html'>There are a few simple steps for building using the CMake system. It's worth noting that when using CMake, all the output files are put into a separate build directory. This prevents the source directory from getting cluttered with files. Assuming that the source files are in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ibcp&lt;/span&gt; sub-directory, an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ibcp-build&lt;/span&gt; directory will be created. These commands are used for building the project:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mkdir ibcp-build&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd ibcp-build&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cmake ../ibcp&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;If no errors occur from Step 3 (like the correct version of GCC was not found), then Step 4 will build the program. All auto-generated include files, object files and the program will be located in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ibcp-build&lt;/span&gt; directory. To enable debug information in the executable, the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ccmake&lt;/span&gt; program is used with these steps:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ccmake ../ibcp&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Press Enter on the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CMAKE_BUILD_TYPE&lt;/span&gt; line&lt;/li&gt;&lt;li&gt;Type in "&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Debug&lt;/span&gt;" and press Enter&lt;/li&gt;&lt;li&gt;Press [&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;c&lt;/span&gt;] to configure&lt;/li&gt;&lt;li&gt;Press [&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;g&lt;/span&gt;] to generate and exit&lt;/li&gt;&lt;li&gt;Now entering make will build with debug information&lt;/li&gt;&lt;/ol&gt;Setting the string to "&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Release&lt;/span&gt;" in Step 3 will turn off the debugging information. There is also a "&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make&amp;nbsp;clean&lt;/span&gt;" option. If the build is not performed in the source directory (possible but not recommended), the entire contents of the build directory can also be deleted and cmake rerun. Now that CMake is working on Linux, it is now time to make it work under Windows...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8740976199763666460?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8740976199763666460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/using-cmake-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8740976199763666460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8740976199763666460'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/using-cmake-system.html' title='Using the CMake System'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1195173020666499041</id><published>2011-06-20T22:19:00.000-04:00</published><updated>2011-06-20T22:19:00.110-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>The CMake System</title><content type='html'>The CMake system consists of a CMakeLists.txt file that describes how to generate the make file that will be used for building a project. The initial CMakeLists.txt file consisted of these major sections:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Check that the GCC version is 4.5 or later.&lt;/li&gt;&lt;li&gt;Find the awk program.&lt;/li&gt;&lt;li&gt;Pass version information to the IBCP source.&lt;/li&gt;&lt;li&gt;Create custom commands for the auto-generated header files.&lt;/li&gt;&lt;li&gt;Define the lists of header and source files.&lt;/li&gt;&lt;li&gt;Add linker definitions for the static library linking.&lt;/li&gt;&lt;li&gt;Define the executable.&lt;/li&gt;&lt;/ol&gt;Step 1 is needed to make sure the needed version of the GCC compiler is installed and setup correctly. Step 2 checks if the awk program is available and gets it's path - the awk program is needed to create the auto-generated header files. Step 3 is to pass program version and copyright information to the source program. This is accomplished by an ibcp_config.h.in file with definitions set to CMake variables to create an ibcp_config.h file that will be included in the source.&lt;br /&gt;&lt;br /&gt;Step 4 contains two custom commands to run awk to create the two auto-generated header files. The awk scripts were modified to take a command line argument for the path of where the output files are to written to since the awk scripts will be run in the build directory, not in the source directory. This path argument was made optional and if not provided, the awk scripts assume the current directory. In the CMakeLists.txt custom commands, the source directory path is passed to the awk scripts. The auto-generated header files are now written into the build directory (CMake calls this the binary directory), not the source directory, so a statement was also needed in CMakeLists.txt to include the binary directory to the list of paths that are searched for header files.&lt;br /&gt;&lt;br /&gt;In Step 5, the list of header and source files are put into CMake variables. These variables are used to define what the dependencies are and are used to build the executable. Step 6 adds the ‑static‑libgcc and ‑static‑libstc++ linker options. Finally, Step 7 defines the executable, which depends on the auto-generated header files, the project header files and the source files. The ".exe" is not needed on the executable program name as CMake will automatically add it for Windows, but not for Linux (CMake is aware of which system is being used for building).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1195173020666499041?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1195173020666499041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/cmake-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1195173020666499041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1195173020666499041'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/cmake-system.html' title='The CMake System'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8826667132219867256</id><published>2011-06-19T21:42:00.003-04:00</published><updated>2011-06-25T07:33:06.156-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>New Make System</title><content type='html'>The standalone make file was originally generated by a feature in NetBeans, and was heavily modified to make it work, but it never looked very clean. Some consideration was given to rewriting it using the proper make rules (having individual build rules for each individual source file is not the way make is suppose to be utilized).&lt;br /&gt;&lt;br /&gt;Continuing to use the make system within NetBeans was not desirable, though it allows the setup to deal with multiple platforms (Linux and Windows). A reason for not using it is that releasing all the associated files is not really an ideal option. And it never really worked right for the auto-generated include files from the awk scripts - warnings were generated for every build and no solution for eliminating these warnings was ever found (perhaps this was a bug in 6.9.1 that may have been fixed in 7.0).&lt;br /&gt;&lt;br /&gt;Using the GNU autotools was out of the question - way too complicated and too much time coming up to speed with it. Instead the CMake system (Cross platform make generator) will be used as it is far simpler to setup and use. Plus NetBeans is supposed to understand CMake files. Adding CMake on Kubuntu installed version 2.8.2, however, this version did not contain the ccmake user interface for configuring the build. So the Linux source for version 2.8.4 (the latest) was downloaded (from &lt;a href="http://www.cmake.org/cmake/resources/software.html"&gt;here&lt;/a&gt;) and installed.&lt;br /&gt;&lt;br /&gt;There are two prerequisite packages that are required to build the CCMake GUI (more on this later), which are the libncurses5 and libncurses5-dev packages. These can be installed with this command:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;sodu apt-get install &amp;lt;package-name&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8826667132219867256?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8826667132219867256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/new-make-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8826667132219867256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8826667132219867256'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/new-make-system.html' title='New Make System'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-284375879829448267</id><published>2011-06-19T08:20:00.002-04:00</published><updated>2011-06-26T10:29:54.651-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><category scheme='http://www.blogger.com/atom/ns#' term='NetBeans'/><title type='text'>Upgrade to NetBeans 7.0</title><content type='html'>Netbeans 7.0 was recently released (version 6.9.1 was being used for development on Windows), which contains support for git via a plug-in. Getting that to work took some research and experimentation. It appeared that the git plug-in only allowed creating a new git repository, not opening an existing one. However, it was discovered that if a new project is created from existing source and standalone make file in a directory with a git repository, NetBeans will then see the repository.&lt;br /&gt;&lt;br /&gt;There was a problem building the project. The compiler complained that it didn't recognize the -static-libstdc++ option. NetBeans was still executing GCC 4.4.5, even though it was correctly pointing to the GCC 4.6.0 directory. Setting the path to include GCC 4.6.0 before executing NetBeans from the command line did not help.&lt;br /&gt;&lt;br /&gt;Next an attempt was made to run the debugger on the project. There was no debug option in the standalone make file. Previously, the project was set up under NetBeans and it generated its own complex and convoluted set of files for generating what it needed to build the project. Both a Release and a Debug configuration was created by NetBeans. To release the project, NetBeans was used to create a standalone make file instead of releasing all the NetBeans files, which would have required NetBeans to build.&lt;br /&gt;&lt;br /&gt;This time around, NetBeans was given this (heavily modified) make file when the project was created, though there was no Debug configuration. The make file was temporarily modified to turn on debug compiling. The make system needs to be reworked to allow both a release and debug configuration without using the system built into NetBeans.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-284375879829448267?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/284375879829448267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/upgrade-to-netbeans-70.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/284375879829448267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/284375879829448267'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/upgrade-to-netbeans-70.html' title='Upgrade to NetBeans 7.0'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8321424065555889627</id><published>2011-06-18T10:19:00.005-04:00</published><updated>2011-06-24T21:36:58.393-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Linker Problem on Linux</title><content type='html'>Now that the program builds and runs on Windows, it was time to make sure it still worked on Linux. However, the linker failed because the compiler/linker did not understand that ‑static‑libstdc++ option. Upon research, it was discovered that this option was only in GCC version 4.5 and later, so it was not available in the GCC 4.4.5 on Kubuntu.&lt;br /&gt;&lt;br /&gt;The latest version of GCC (4.6.0) was downloaded and installed on Kubuntu using the source code. This required quite a bit of work to accomplish (for complete details, hit the continue link). Now that the project was building on both Linux and Windows, it was time to introduce it to the NetBeans IDE (which was now at version 7.0, version 6.9.1 was being used for development on Windows).&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Before GCC 4.6.0 could be built on Linux, some prerequisite packages and libraries need to be installed first. &amp;nbsp;The packages include m4, autoconf, automake, libtool and&amp;nbsp;libc6-dev-i386. &amp;nbsp;Each of these can be installed with this command:&lt;br /&gt;&lt;blockquote&gt;sudo apt-get install &amp;lt;package&amp;gt;&lt;/blockquote&gt;The libraries include GMP (GNU Multiple Precision arithmetic library), MPFR (Multiple Precision Floating point library with correct Rounding) and MPC (Multiple Precision Complex number library). The sources of the latest version of each of these were downloaded and installed (GMP 5.0.1, MPFR 3.0.1 and MPC 0.9). The procedure used for installing each of these were:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;uncompress the library source (&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tar&amp;nbsp;xjf&amp;nbsp;xxx.tar.bz2&lt;/span&gt; or &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tar&amp;nbsp;xjf&amp;nbsp;xxx.tar.gz&lt;/span&gt;)&lt;/li&gt;&lt;li&gt;change to the new directory created (&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd&amp;nbsp;xxx&lt;/span&gt;)&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;./configure&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo make install&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;All of these libraries were installed at &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/usr/local/lib&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/usr/local/include&lt;/span&gt;&amp;nbsp;by default. Now GCC&amp;nbsp;4.6.0 was successfully built and installed using this procedure:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tar&amp;nbsp;xjf&amp;nbsp;gcc‑4.6.0.tar.bz2&lt;/span&gt; ‑or‑ &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tar&amp;nbsp;tzf&amp;nbsp;gcc‑4.6.0.tar.gz&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mkdir gcc-4.6.0-build&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd gcc-4.6.0-build&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;../gcc‑4.6.0/configure ‑‑prefix=/usr/gcc‑4.6.0 ‑‑with‑gmp=/usr/local ‑‑with‑mpfr=/usr/local ‑‑with‑mpc=/usr/local&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;export LD_LIBRARY_PATH=/usr/local/lib&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make bootstrap-lean&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo make install&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;For a multiple core processor, the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;‑jX&lt;/span&gt; where &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;X&lt;/span&gt; is the number of cores, can be added to the make commands to speed up the build. This will install GCC into the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/usr/gcc‑4.6.0&lt;/span&gt; so as not to overwrite the GCC that comes with Kubuntu. However, the PATH and library environment variables need to be set properly so it uses GCC&amp;nbsp;4.6.0 and not GCC&amp;nbsp;4.4.5 (or whichever version is installed). To do this, these commands are used:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;export PATH=/usr/gcc‑4.6.0/bin:$PATH&lt;br /&gt;export LD_LIBRARY_PATH=/usr/gcc‑4.6.0/lib64:/usr/gcc‑4.6.0/lib:/usr/local/lib&lt;/span&gt;&lt;/blockquote&gt;Which can be put into a script file (for example &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;~/bin/gcc460&lt;/span&gt;) and executed using the command "&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;.&amp;nbsp;~/bin/gcc460&lt;/span&gt;" to set the variables. The period tells the current shell to execute the script directly, otherwise the script is executed in a new shell and when done, terminates having no effect in the current shell. The &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gcc‑4.6.0&lt;/span&gt; (source) and &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gcc‑4.6.0‑build&lt;/span&gt; directories can safely be removed once GCC&amp;nbsp;4.6.0 is successfully installed, along with the directories used to build the three prerequisite libraries.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8321424065555889627?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8321424065555889627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/linker-problem-on-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8321424065555889627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8321424065555889627'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/linker-problem-on-linux.html' title='Linker Problem on Linux'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2917691982326281890</id><published>2011-06-17T22:28:00.004-04:00</published><updated>2011-06-17T22:28:00.336-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Running on Windows</title><content type='html'>There were no problems building the modified project back on Windows, however, when running the regression test script on Windows, all tests failed. This occurred because the expected test results files were in Unix (LF only) format, but the freshly generated output files were in DOS (CRLF) format. &amp;nbsp;The files otherwise appeared to be identical.&lt;br /&gt;&lt;br /&gt;To verify that the output was the same, the test script was modified where the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cmp&amp;nbsp;‑s&lt;/span&gt;&lt;/b&gt; command (&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;‑s&lt;/span&gt;&lt;/b&gt; for silent) was replaced with a &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;diff&amp;nbsp;‑bq&lt;/span&gt;&lt;/b&gt; command (&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;‑b&lt;/span&gt;&lt;/b&gt; for ignore white-space, &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;‑q&lt;/span&gt;&lt;/b&gt; for quiet) to have it ignore the differences between CRLF and LF, both considered white-space. Now all tests compared to the expected results. A better solution will need to be found to deal with the differences between Windows and Linux.&lt;br /&gt;&lt;br /&gt;One other problem was found when trying to run on Windows, which was discovered when trying to make the program run. Upon the first run, an error was reported that the application failed to start because &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;libstdc++‑6.dll&lt;/span&gt; was not found. Once the environment variables were adjusted to include the MinGW binary path, the program ran fine.&lt;br /&gt;&lt;br /&gt;This was the same problem as before with &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;libgcc_s_dw2&amp;#8209;1.dll&lt;/span&gt;. This problem was resolved by adding a -static-libgcc option to the linker step, which links in the libgcc.a library. It turns out that there is similar option &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;#8209;static&amp;#8209;libstdc++&lt;/span&gt; for linking in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;libstdc++.a&lt;/span&gt; library. The program no ran without requiring any external library. This was tested by moving the program to another computer that did not have MinGW installed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2917691982326281890?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2917691982326281890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/running-on-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2917691982326281890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2917691982326281890'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/running-on-windows.html' title='Running on Windows'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5146369897640614545</id><published>2011-06-16T22:45:00.001-04:00</published><updated>2011-06-16T22:45:00.898-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Setting up and Building on Windows</title><content type='html'>Now that the code was building and working on Linux, it was time to setup the Windows XP virtual machine for building. &amp;nbsp;On the previously Windows XP installation, MinGW (with GCC 3.4.6) and MSYS (1.0.11) were installed with a number of packages installed later (like GCC 4.4.0). It was a very hacked together setup in attempt to make things work right.&lt;br /&gt;&lt;br /&gt;This time around, the Automated MinGW Installer was used. The current 2011-05-30 version was used, which contains the latest versions of MSYS, MinGW and all the other utilities. &amp;nbsp;The latest version can be obtained &lt;a href="http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/"&gt;here&lt;/a&gt;. When installing this package (which actually downloads all the latest versions before installation), both the MSYS and MinGW options were selected. The version of GCC installed was 4.5.2.&lt;br /&gt;&lt;br /&gt;Moving the project software back over to Windows, the build succeeded. Turns out the awk scripts still work in Windows. There was also no warning about the gets() function. This may be because the version implemented with MinGW contains more features, which were mentioned back on &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2010/06/translator-print-command-release.html"&gt;June 15, 2010&lt;/a&gt; and are not implemented in the Linux version.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5146369897640614545?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5146369897640614545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/setting-up-and-building-on-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5146369897640614545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5146369897640614545'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/setting-up-and-building-on-windows.html' title='Setting up and Building on Windows'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2822734254198528381</id><published>2011-06-15T22:53:00.001-04:00</published><updated>2011-06-15T22:53:00.117-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Parser'/><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Integers on 64-bit Linux</title><content type='html'>After a successful compile, the regression test script aborted with errors. The errors occurred because it was trying to execute &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ibcp&lt;/span&gt;&lt;/b&gt; but the make file was building &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ibcp.exe&lt;/span&gt;&lt;/b&gt;. This worked on Windows because it will execute &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;ibcp.exe&lt;/b&gt;&lt;/span&gt; when the command is &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ibcp&lt;/span&gt;&lt;/b&gt;. The script was modified to run &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;ibcp.exe&lt;/b&gt;&lt;/span&gt; instead (this issue will be resolved shortly). Now only two of the parser tests and one of the translator test failed.&lt;br /&gt;&lt;br /&gt;The first parser test (immediate commands) was not working on the inputs containing large values for line numbers or increments that were suppose to be reported as an error, but now were being accepted and the value output was not the same as the input. A problem in the third parser test (numbers) was a negative integer one beyond the limit of an integer, was now also being accepted as an integer (it should have become a double since it was out of range for an integer). And a problem on the 17th translator test (negative values) was another negative number out of range of an integer, was also being accepted.&lt;br /&gt;&lt;br /&gt;These problems were caused by the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;strtol()&lt;/span&gt;&lt;/b&gt; function calls used to convert strings to an integer. An overflow was expected for these large numbers. This function returns a &lt;b&gt;&lt;i&gt;long&lt;/i&gt;&lt;/b&gt; integer and on 32-bit Windows (or any 32-bit OS) this is the same as integer values, which is 32 bits, so an overflow was reported. However, on 64-bit Linux (or any 64-bit OS), long integers are 64 bits, so these large values were now being accepted, but when converting to an integer, were being truncated from 64 bits to 32 bits.&lt;br /&gt;&lt;br /&gt;To correct this problem, in additional to the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ERANGE&lt;/span&gt;&lt;/b&gt; (overflow) error occurred condition, a condition was added to check if beyond the maximum integer using the predefined constant &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;INT_MAX&lt;/span&gt;&lt;/b&gt; (and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;INT_MIN&lt;/span&gt;&lt;/b&gt; when the value could also be negative).&lt;br /&gt;&lt;br /&gt;The remaining problem in the third parser test was that only two digits were output for floating point exponents on Linux if a third (the hundreds) digit was not required. On Windows, three digits are always output for the exponent. This must be due to slightly different builds or implementation of the standard C library functions. How to deal with this problem for testing will be dealt with a little later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2822734254198528381?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2822734254198528381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/integers-on-64-bit-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2822734254198528381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2822734254198528381'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/integers-on-64-bit-linux.html' title='Integers on 64-bit Linux'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-3732231772203564165</id><published>2011-06-14T22:17:00.003-04:00</published><updated>2011-06-14T22:17:00.231-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Resolving 64-bit Linux Build Problems</title><content type='html'>There were problems with the awk scripts - they were not generating the auto-generated includes files. This was caused by the RS (Record Separator) and ORS (Output Record Separator) variables being set to CRLF to work with Windows. The files were now all in Unix (LF) format and so the input source files not being read correctly. So the RS and ORS lines were commented.&lt;br /&gt;&lt;br /&gt;The git configuration option autocrlf was set to false, causing git upon checkout to change any DOS (CRLF) format files in the repository to be converted to Unix format (LF), or the CRLF was removed when the CVS repository was converted to git. There were previous problems with CRLF on Windows when switching between cvs with MSYS to CVSNT (all the files were changed to DOS format since CVSNT didn't seem to like Unix format files).&lt;br /&gt;&lt;br /&gt;Next there were warnings about the gets() function calls in the test routines, which were not present on Windows (using GCC 4.4.0 on MinGW/MSYS). After updating with the package manager, Kubuntu had GCC 4.4.5, so perhaps this was a change between 4.4.0 and 4.4.5 or a difference between the GCC build on MinGW vs. Kubuntu. The warning complained that the returned value from gets() was being ignored. To remove the warnings, statements were add to check the return value.&lt;br /&gt;&lt;br /&gt;The linker also warned that the gets() function is dangerous and should not be used. This is probably because gets() does not check for a buffer overflow of the allocated buffer given to it. The buffer allocated is plenty big for testing here and this is just the test code anyway, so this warning will be ignored from the time being.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-3732231772203564165?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/3732231772203564165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/resolving-64-bit-linux-build-problems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3732231772203564165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3732231772203564165'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/resolving-64-bit-linux-build-problems.html' title='Resolving 64-bit Linux Build Problems'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-86681148305455901</id><published>2011-06-13T23:43:00.000-04:00</published><updated>2011-06-13T23:43:02.529-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Building on 64-bit Linux</title><content type='html'>Before attempting the build the project on Linux, the version control repository of the project code was converted from the Concurrent Versioning System (CVS) to git, a more modern version control system. The version installed using Kubuntu's software package manager was 1.7.4.4. However, this version did not have the needed cvs import utility, so the latest version was installed directly from the git repository, though git is required to retrieve it. This was version 1.7.6. Using git will have no impact on this project's software releases except that the CVS versions tags will be removed from the source files.&lt;br /&gt;&lt;br /&gt;The intention was to use command line make file distributed with the project to build on Linux. Previously on Windows, NetBeans was used to build the project, though the command line make file (which was initialized generated by an option in NetBeans) was used to test the project before a release. For the moment, NetBeans would not be used (more about this later). Some minor problems needed to be resolved before it would build and work on Linux...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-86681148305455901?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/86681148305455901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/building-on-64-bit-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/86681148305455901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/86681148305455901'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/building-on-64-bit-linux.html' title='Building on 64-bit Linux'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5639714471193903148</id><published>2011-06-12T21:24:00.000-04:00</published><updated>2011-06-12T21:24:17.959-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Development Environment Change</title><content type='html'>Because of a job requirement, I had to install 64-bit Linux on my computer (I chose Kubuntu 10.10, Maverick Meerkat). So development of this project will be moved over to 64-bit Linux, at least for the time being. Since so far, the program only has a simple command line interface (no GUI), this won't cause an immediate problem. The releases will still be tested under Windows XP as I have a Windows XP virtual machine running on Kubuntu. Perhaps when the time comes to start on the GUI, a common tool set will chosen, something like Qt.&lt;br /&gt;&lt;br /&gt;For the moment, this will also give the opportunity to present how to set up Windows to be able to build the project since this virtual machine is a new Windows installation and not a clone of my of my previous Windows installation. A lot of things were originally tried and listing the procedure that finally worked in the end was probably impossible.&lt;br /&gt;&lt;br /&gt;Also possibly changing will be the actual development tools that will be used. Under consideration is changing the version control system (from cvs to git), the IDE (from NetBeans 6.9.1 to newer version 7.0, which has a plug-in for git, or possibly to the Eclipse CDT IDE), and the build system to build the project (from NetBeans' make system and standalone make file currently distributed with the project to the cmake build system). Each of these will be explained in the posts that follow...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5639714471193903148?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5639714471193903148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/development-environment-change.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5639714471193903148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5639714471193903148'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/06/development-environment-change.html' title='Development Environment Change'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-3621500516598414179</id><published>2011-03-30T22:13:00.000-04:00</published><updated>2011-03-30T22:13:00.223-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Colon (Design)</title><content type='html'>The colon token will work very similar to the end-of-line token and so will have the end statement flag in its table entry. The difference with the end-of-line token is that instead of terminating the translation or a line, the token mode will be set to command for the next statement.&lt;br /&gt;&lt;br /&gt;There will be two error conditions. Two colons will not be allowed. While a second colon would not affect anything and is allowed in other BASICs, it will be considered an error here. There is no point to allowing this. Also, a colon will not be allowed at the end of the line with no command after it.&lt;br /&gt;&lt;br /&gt;When a colon token is received, the colon sub-code will be set in the command token on top of the command stack. The command token will be appended to the end of the statement when the command has been processed (by the command handler).&lt;br /&gt;&lt;br /&gt;However, there is an issue with print statements. The actual print command token may not be appended to the output if there is a semicolon, comma or print function at the end of the print statement. In this case, the print command handler will have to transfer the colon sub-code to the last print code that was appended to the output, which may be a print type (when a semicolon is not needed), comma, semicolon, SPC or TAB.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-3621500516598414179?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/3621500516598414179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-colon-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3621500516598414179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3621500516598414179'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-colon-design.html' title='Translator – Colon (Design)'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-7388314904521733140</id><published>2011-03-29T21:30:00.000-04:00</published><updated>2011-03-29T21:30:24.987-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Language'/><title type='text'>Colon – Statement Separator</title><content type='html'>The Colon is used to separate statements in the BASIC language though it is not part of the ANSI BASIC, it is part of the more common BASICs (GW-Basic, QBasic, FreeBasic, etc.). Before moving to the translation of colon tokens, like everything else, the action during run-time must be defined. &amp;nbsp;However, the Colon does not actually do anything at run-time.&lt;br /&gt;&lt;br /&gt;Colons don't actually need to be stored as separately in the program, however, for them to be reproduced, something needs to be put into the internal program. The assumption that there will be a colon at the end of each statement except at the end of the line is not sufficient. Consider this statement:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;IF A&amp;gt;B THEN PRINT A ELSE PRINT B:A=B:B=0.0&lt;/span&gt;&lt;/blockquote&gt;There is no colon after the first print statement. To reproduce colons properly, there will be a colon sub-code set for a command token that has a colon following the statement. For the statements after the ELSE in the example above, the colon sub-code will be set as shown in this translation:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;B PrintDbl'Colon' A&amp;lt;ref&amp;gt; B Assign'Colon' B&amp;lt;ref&amp;gt; 0.0 Assign&lt;/span&gt;&lt;/blockquote&gt;When a line is reproduced, the Recreator will add a colon after a statement that has the colon sub-code set.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-7388314904521733140?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/7388314904521733140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/colon-statement-separator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7388314904521733140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7388314904521733140'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/colon-statement-separator.html' title='Colon – Statement Separator'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8418693779934887618</id><published>2011-03-27T19:13:00.000-04:00</published><updated>2011-03-27T19:13:56.455-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – A Unary Operator Curiosity</title><content type='html'>One of the test statements created for testing the unary operator fix was:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A = -B^NOT C% + -D*NOT E%&lt;/span&gt;&lt;/blockquote&gt;The intention of this statement was test the NOT unary operator in front of the second operand of both the exponentiation and multiplication operators. The translation of this statement was expected to be (the blue expression being the first operand and the red expression being the second operand of the addition):&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A&amp;lt;ref&amp;gt; &lt;span class="Apple-style-span" style="background-color: #9fc5e8;"&gt;B C% NOT ^* Neg&lt;/span&gt; &lt;span class="Apple-style-span" style="background-color: #ea9999;"&gt;D Neg E% NOT *%2&lt;/span&gt; + Assign&lt;/span&gt;&lt;/blockquote&gt;However, what was produced was this unexpected translation:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A&amp;lt;ref&amp;gt; B C% &lt;span class="Apple-style-span" style="background-color: yellow;"&gt;D Neg E% NOT *%2 +%1 Cvtint NOT&lt;/span&gt; ^* Neg Assign&lt;/span&gt;&lt;/blockquote&gt;Upon reviewing the precedence of the operators (see &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2010/03/translator-operator-precedence.html"&gt;Translator – Operator Precedence&lt;/a&gt;) and the code, it turns out that this translation was correct. The ADD is higher precedence than the NOT, so the operands of the ADD are &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C%&lt;/span&gt;&lt;/b&gt; and the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;–D*NOT&amp;nbsp;E%&lt;/span&gt;&lt;/b&gt; expression with MUL (&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;*%2&lt;/span&gt;&lt;/b&gt;) higher precedence than ADD, its operands are the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;–D&lt;/b&gt;&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;NOT&amp;nbsp;E%&lt;/b&gt;&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;So while the exponentiation is highest precedence, with NOT having a low precedence allowed the ADD to bind the rest of the expression to the NOT, which becomes the second operand (yellow above) of the exponentiation, with the first negation being the final operator. In C/C++, the not (&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;!&lt;/span&gt;&lt;/b&gt;) and negation (&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;-&lt;/b&gt;&lt;/span&gt;) operators are very high precedence (and there is no exponentiation operator). But here, NOT was given a low precedence just above the other logical operators but below the math operators (see&amp;nbsp;&lt;a href="http://interactivebasiccompilerproject.blogspot.com/2010/03/translator-operator-precedence.html"&gt;Translator – Operator Precedence&lt;/a&gt;&amp;nbsp;for reasoning). Normally the NOT operator would probably not be used in the same expression as exponentiation like above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8418693779934887618?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8418693779934887618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-unary-operator-curiosity.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8418693779934887618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8418693779934887618'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-unary-operator-curiosity.html' title='Translator – A Unary Operator Curiosity'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2373194883728554165</id><published>2011-03-27T14:44:00.000-04:00</published><updated>2011-03-27T14:44:41.571-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Unary Operator Problem</title><content type='html'>While testing the negative constant changes, a new problem was discovered with unary operators, specifically this statement:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A = ---B&lt;/span&gt;&lt;/blockquote&gt;Which produced a “&lt;i&gt;done stack empty&lt;/i&gt;” bug error at the first negation token. The problem occurred because the second negation operator forced the first negation operator from the hold stack because it was greater or equal precedence, and when checking the operand of the first negation operator, there was nothing on the done stack. Here and some additional examples:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A = B*-C&lt;br /&gt;A = B^-C&lt;/span&gt;&lt;/blockquote&gt;The first statement translated correctly because negation is higher precedence than multiplication leaving multiplication on the hold stack. However, the second statement failed because negation is lower precedence than exponentiation forcing exponentiation from the hold stack but with only one operand on the done stack generating the done stack empty bug error. A new rule was needed for unary operators.&lt;br /&gt;&lt;br /&gt;Basically, unary operators should not force any tokens (unary operators, binary operators, arrays, or functions) from the hold stack regardless of their precedence because not all of their operands have been received yet (the negate and its operand will be their operand and it has not been fully received yet). As currently implemented, other non-unary operators should still force unary operators from the done stack if the unary operator has higher precedence.&lt;br /&gt;&lt;br /&gt;The check to force tokens from the hold stack was changed to if the precedence of the operator on the hold stack is higher than the current operator &lt;i&gt;&lt;b&gt;and&lt;/b&gt; if the current token is &lt;b&gt;not&lt;/b&gt; a unary operator&lt;/i&gt;. Unary operators will now &lt;i&gt;not&lt;/i&gt; force other tokens from the hold stack, but other tokens will still force unary operators from the hold stack if higher in precedence. While testing this change, a curious result was produced from one of the test statements...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2373194883728554165?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2373194883728554165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-unary-operator-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2373194883728554165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2373194883728554165'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-unary-operator-problem.html' title='Translator – Unary Operator Problem'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2004439476312953499</id><published>2011-03-27T10:55:00.000-04:00</published><updated>2011-03-27T10:55:55.363-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Parser'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Parser – Negative Constants</title><content type='html'>Negative constants were previously not considered by the Parser, which interpreted a minus as the subtract operator. The Translator then changed it to a negate operator when it appeared in the operand state. Consider these two examples (along with there current translations):&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A = B-1.5 &amp;nbsp; &amp;nbsp; &amp;nbsp;A B 1.5 Sub Assign&lt;br /&gt;A = -1.5+B &amp;nbsp; &amp;nbsp; A 1.5 Neg B Sub Assign&lt;/span&gt;&lt;/blockquote&gt;The reason for the Parser to not look for signs on numerical constants can be seen in the first example. If the Parser produced the four tokens &lt;b&gt;A&lt;/b&gt; &lt;b&gt;=&lt;/b&gt; &lt;b&gt;B&lt;/b&gt; &lt;b&gt;-1.5&lt;/b&gt;, the Translator would generate an “&lt;i&gt;expected operator&lt;/i&gt;” error at the &lt;b&gt;-1.5&lt;/b&gt;&amp;nbsp;token since a second operand token was received when it was expecting a binary operator. The second example produces an unnecessary negate token after the constant. While perfectly valid, this is not desirable.&lt;br /&gt;&lt;br /&gt;In order for the Parser to correctly interpret negative signs on numerical constants, it needs to be aware of whether the Translator is in operand state or not. If in operand state, the Parser can look for a negative sign in front of a number constant, otherwise a minus should be interpreted as an operator.&lt;br /&gt;&lt;br /&gt;A new operand state flag was added to the Parser with an access function to set its value (which is initialized to off). The Parser get number routine was modified to have a new sign flag used to determine if a negative sign was found first. This flag will also prevent multiple negative signs. However, it will only check for a negative sign if no digits or a decimal was seen and if the new operand state flag is on.&lt;br /&gt;&lt;br /&gt;An access function was added to the Translator to get the current operand state (either &lt;b&gt;operand&lt;/b&gt; or &lt;b&gt;operand-or-end&lt;/b&gt; state). Before calling the Parser get token routine, the Parser operand state is set from the Translator's current operand state. While testing, a problem was discovered with unary operators...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2004439476312953499?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2004439476312953499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/parser-negative-constants.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2004439476312953499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2004439476312953499'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/parser-negative-constants.html' title='Parser – Negative Constants'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-3127709809104746038</id><published>2011-03-26T20:54:00.000-04:00</published><updated>2011-03-26T20:54:00.379-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Parser'/><title type='text'>Parser – Tokens With Parentheses</title><content type='html'>While correcting issues with define function tokens, it was noticed that it is not necessary to also store the opening parentheses in the string field of the token. This also includes the generic tokens with parentheses. The parentheses is not necessary because there are separate token types to identify tokens with and without parentheses.&lt;br /&gt;&lt;br /&gt;It is also advantageous to not store the parentheses so that an array or define function name can be found in the dictionary. For define functions, take the code snippet:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DEF FNHypot(X,Y)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FNHypot=SQR(X*X+Y*Y)&lt;br /&gt;END DEF&lt;br /&gt;Z = FNHypot(3,4)&lt;/span&gt;&lt;/blockquote&gt;Both the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;FNHypot(&lt;/span&gt;&lt;/b&gt; and &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;FNHypot&lt;/b&gt;&lt;/span&gt; tokens appear, which represent the same function. If the parentheses was stored in the dictionary for the function name, it would require complicated string comparisons to figure out that the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;FNHypot&lt;/span&gt;&lt;/b&gt; token is the same function. This same issue applies to regular function names.&lt;br /&gt;&lt;br /&gt;A similar issue also applies to arrays. When functions and subroutines are implemented, there will be a feature to allow an entire array to be passed to a function or subroutine. Exactly how this will work has not been defined yet, but this code snippet shows how it would look:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DIM Array(10)&lt;br /&gt;CALL subroutine(A)&lt;/span&gt;&lt;/blockquote&gt;The changes for removing the parentheses from these tokens were very simple. In the Parser get identifier routine, when creating the string for these tokens, the length provided to the string constructor was changed to be one less than the actual length so the parentheses would not be included. In the Translator when reporting an error at the open parentheses of a define function with parentheses token, the minus one was removed since the length is now one less. Finally, in the token test output routines, an open parentheses was added to the output of these tokens.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-3127709809104746038?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/3127709809104746038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/parser-tokens-with-parentheses.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3127709809104746038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3127709809104746038'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/parser-tokens-with-parentheses.html' title='Parser – Tokens With Parentheses'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4598013719125555696</id><published>2011-03-26T17:24:00.000-04:00</published><updated>2011-03-26T17:24:16.522-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Project – Tokens Status Enumeration</title><content type='html'>Each time a new error (token status) is added, renamed or deleted, two changes were needed. Both the token status enumeration (include file) and the message array (source file) needed to be changed. The correct changes were needed or the two files will be out of sync. To check for problems, code had been added to initialization to check for duplicates and missing entries.&lt;br /&gt;&lt;br /&gt;Similar to automatic generation of the code enumeration from the table entries, the token status enumeration will also be generated automatically. Each message array element was a structure containing a token status value and a pointer to a message string. The elements were changed to just the message string with the name of the token status in a comment at the end of the line.&lt;br /&gt;&lt;br /&gt;The codes awk script was renamed to enums and was modified to also read the token status message array to generate the token status enumeration automatically be reading the name in the comment after the message string. The name of the output file was changed from &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;codes.h&lt;/span&gt; to &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;autoenums.h&lt;/span&gt; to be more generic and allow for additional automatic enumerations.&lt;br /&gt;&lt;br /&gt;During initialization, in addition to checking for duplicates and missing entries, a translation index array was built to translate from token status value to index. Both the checking and the translation array were removed since they are no longer necessary. The awk script will check for duplicates and the token status is now the same as the index into the message array.&lt;br /&gt;&lt;br /&gt;The error type template class is no longer needed for token status errors (but still for the table entry erros). Also, the duplicate and missing were no longer needed and were removed. Some problems were found in this template class for table entries where the range error was not working because the wrong constructor was being called. Instead of storing indexes to the errors, the variables were changed to be the type of the template. This made the range error constructor unique.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4598013719125555696?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4598013719125555696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/project-tokens-status-enumeration.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4598013719125555696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4598013719125555696'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/project-tokens-status-enumeration.html' title='Project – Tokens Status Enumeration'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-6659247370660751849</id><published>2011-03-25T22:08:00.000-04:00</published><updated>2011-03-25T22:08:24.757-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><category scheme='http://www.blogger.com/atom/ns#' term='Release'/><title type='text'>Translation – INPUT Command (Release)</title><content type='html'>The remaining problem was due to the input command handler deleting the token passed in (the token terminating the invalid string prompt expression), however, the caller (the call command handler routine) was also deleting the token since the command handler changed the token to point to the error token. The extra token delete was removed from the input command handler.&lt;br /&gt;&lt;br /&gt;The INPUT command is fully working and &lt;a href="http://sourceforge.net/projects/ibcp/files/ibcp_0.1.15-src.zip/download"&gt;ibcp_0.1.15-src.zip&lt;/a&gt; has been uploaded at &lt;a href="https://sourceforge.net/projects/ibcp/files/"&gt;Sourceforge IBCP Project&lt;/a&gt; along with the binary for the program. &amp;nbsp;To support the INPUT command, several other changes were needed including making the token codes and table entries indexes one in the same, correcting print function issues, correcting sub-string assignment issues, handling assignment token mode differently, handling define function tokens correctly, implementing an end statement Translator state, and implementing the reference token mode.&lt;br /&gt;&lt;br /&gt;Next up, a slight change to the direction of this project to make it a little more interesting. Instead of prodding along with the translation of more commands, work will begin of the other components including the encoder, dictionary, recreator, program (maintaining the internal program and the program editor), and the run-time module.&lt;br /&gt;&lt;br /&gt;The goal is to get this BASIC working as there are (almost) enough commands to make a very simple BASIC program (input, assignments and output). Once this is working, more commands can be implemented. But first a couple of minor things will be implemented before proceeding with this new direction.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-6659247370660751849?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/6659247370660751849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-input-command-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6659247370660751849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6659247370660751849'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-input-command-release.html' title='Translation – INPUT Command (Release)'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-316009828352202259</id><published>2011-03-24T22:03:00.002-04:00</published><updated>2011-03-25T08:52:07.482-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>ranslation – INPUT Error Debugging</title><content type='html'>The main problem with the wrong tokens being reported for errors in the INPUT command was because the token with the error was not put into the command item structure passed to the INPUT command – a requirement of command handlers reporting an error. Once this was added, most of the errors were now pointing to the correct token.&lt;br /&gt;&lt;br /&gt;A new “&lt;i&gt;expected operator, semicolon or comma&lt;/i&gt;” error was added for when an end statement token (for example the EOL in the incomplete statement &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;INPUT PROMPT A$&lt;/span&gt;&lt;/b&gt;) is received after a valid string expression because this is a little more accurate than just the “&lt;i&gt;expected semicolon or comma&lt;/i&gt;” error.&lt;br /&gt;&lt;br /&gt;The two remaining errors were “&lt;i&gt;invalid mode&lt;/i&gt;” bug errors that were occurring in the end expression error routine that is called when an end statement token is received during operand state. Support for the reference mode needed to be added to this routine, which needed to return the “&lt;i&gt;expected variable&lt;/i&gt;” error.&lt;br /&gt;&lt;br /&gt;One problem remains. The error test statement &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;INPUT PROMPT A+B*C&lt;/span&gt;&lt;/b&gt; is causing extra token deletes, which was detected by the memory leak detection mechanism that was implemented a little while ago. To be continued...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-316009828352202259?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/316009828352202259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/ranslation-input-error-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/316009828352202259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/316009828352202259'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/ranslation-input-error-debugging.html' title='ranslation – INPUT Error Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-6137884336466416272</id><published>2011-03-23T22:11:00.000-04:00</published><updated>2011-03-23T22:11:00.161-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – INPUT PROMPT Debugging</title><content type='html'>The first problem found with the INPUT PROMPT command was that reference mode was not being set after the string prompt expression was processed. The next problem was that the Translator was still in &lt;b&gt;binary operator&lt;/b&gt; state following the comma or semicolon after the string prompt string expression was processed, so this required setting the state back to &lt;b&gt;operand&lt;/b&gt; state, which lead to the discovered of some other minor state issues.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;first operand&lt;/b&gt; state is very similar to the &lt;b&gt;operand&lt;/b&gt; state except that end expression tokens (like comma, semicolon, and EOL) are also acceptable (normally considered operators). This state was implemented for the PRINT command since these tokens are allowed when an operand is expected (for example the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PRINT,,A&lt;/span&gt;&lt;/b&gt; statement). This state is also set after a command is received, and it is up to the command handler to decide if an immediate end expression is allowed (which it currently is only for the PRINT command).&lt;br /&gt;&lt;br /&gt;The equal token handler was found to be incorrectly setting the &lt;b&gt;first operand&lt;/b&gt; state in an assignment statement. This did not cause a problem because the end expressions operators were being caught elsewhere when in expressions incorrectly (by their respective token handlers). Anyway, calling it the &lt;b&gt;first operand&lt;/b&gt; state was a little confusing and was therefore renamed more appropriately to the &lt;b&gt;operand or end&lt;/b&gt; state. The equal token handler was corrected to set only &lt;b&gt;operand&lt;/b&gt; state.&lt;br /&gt;&lt;br /&gt;The valid INPUT PROMPT test statements are now working, now on to the invalid INPUT statements, which for the most part are not reporting the correct token where an error is detected or just not reporting the correct error including some bug errors...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-6137884336466416272?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/6137884336466416272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-input-prompt-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6137884336466416272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6137884336466416272'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-input-prompt-debugging.html' title='Translation – INPUT PROMPT Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5877756867303814198</id><published>2011-03-21T21:58:00.001-04:00</published><updated>2011-03-21T21:58:00.508-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – INPUT Debugging</title><content type='html'>Several minor issues were found and corrected. When the end of the INPUT command occurs, the last input parse code has to be marked with the end sub-code. Support for reference mode also needed to be added to comma token handler.&lt;br /&gt;&lt;br /&gt;When the EOL token was received by the INPUT command handler, it reused the token for the input assign code for the variable. Upon return from command handler, the EOL token handler proceeded to delete the EOL token (which was not the EOL token anymore). To prevent this, a check was added that if the token no longer contains an EOL code, it is assumed to have been used by the command handler and will not be deleted.&lt;br /&gt;&lt;br /&gt;The InputBegin code was just being appended to the output, but the first variable had already been added to the output, so it was after the variable instead of at the start of the statement. This code could be inserted at the beginning of the output list, however, this would only work if the INPUT command was at the beginning of the line, which may not be the case (multiple statements per line will be supported).&lt;br /&gt;&lt;br /&gt;So instead, the element pointer in the command item will be set to the current last item in the output list when a command is pushed to the command stack. Since this pointer can no longer be checked for null to determine if an input begin code has been added, a new input begin command flag was added, which is set once an input begin code has been added to the output.&lt;br /&gt;&lt;br /&gt;Another problem found was that none of the input variables had their reference flag set once added to the output. The find code routine was not checking for a reference (not important) but was clearing the reference flag (a problem) since the token being checked (the input assign code) did not have &lt;i&gt;its&lt;/i&gt; reference flag set. The reference flag of the input assign token was set before calling the process final operand routine to make the find code routine work as desired, and then cleared upon return.&lt;br /&gt;&lt;br /&gt;The valid INPUT test statements are now working, now on to the INPUT PROMPT statements, which are not working...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5877756867303814198?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5877756867303814198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-input-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5877756867303814198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5877756867303814198'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-input-debugging.html' title='Translation – INPUT Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-7956168121028959298</id><published>2011-03-20T08:01:00.002-04:00</published><updated>2011-03-20T08:01:38.689-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>INPUT Translation – Variable Handling and Ending</title><content type='html'>To look up the appropriate input assign code, the process final operand routine is used, which calls the find code routine that checks the token on the done stack to see if the reference flag is set since the input assign codes have the reference flag (this should not be necessary since the INPUT command uses the recently implemented reference mode). The reference variable will be popped from the done stack and the input assign code will be appended to the output before returning.&lt;br /&gt;&lt;br /&gt;The InputAssignInt and InputAssignStr are associated codes for the InputAssign code. Once the input assign code has been appended to the output, the appropriate input parse code needs to be inserted after the input begin code or last input parse code. The easiest way to get the appropriate input parse code was to have each (InputParse, InputParseInt, and InputParseStr) be associated codes to the input assign codes. The second associated code will be used for these.&lt;br /&gt;&lt;br /&gt;When a final semicolon token is received, the stay on line command flag is set (the same flag used for the PRINT command) and the state is set to end statement. When an end statement token is received, the INPUT command handler check if the stay flag is set and sets the keep sub-code of the INPUT command token, which is then appended to the output.&lt;br /&gt;&lt;br /&gt;If an end statement token is received with no semicolon, the INPUT command token is immediately appended to the output without the keep sub-code. The INPUT command handler has now been implemented and the code compiles, so debugging can begin...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-7956168121028959298?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/7956168121028959298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/input-translation-variable-handling-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7956168121028959298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7956168121028959298'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/input-translation-variable-handling-and.html' title='INPUT Translation – Variable Handling and Ending'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1176873860417660957</id><published>2011-03-19T21:47:00.000-04:00</published><updated>2011-03-19T21:47:17.298-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – End Statement State</title><content type='html'>Once a semicolon is received at the end of an INPUT statement, no more tokens should be received except for an end-of-statement token. If another token is received, then an error should be reported. To accomplish this, a new end statement state similar to the end expression state is needed. While the end expression state only needs to be checked when operators are expected, the end statement state needs to be checked for all tokens.&lt;br /&gt;&lt;br /&gt;The end statement state check was added just before the check for operand or first operand state in the main translator add token routine. When in end statement state, if the token does not have the end statement flag set in its table entry, then an “expected end-of-statement” error is reported against the token.&lt;br /&gt;&lt;br /&gt;The access function for getting the table entry flags for a token already checks if the token has a table entry, and if there is not table entry, then zero (no flags) is returned. Currently only the EOL code has the end statement flag set, but eventually the Colon, ELSE and ENDIF tokens will also and possibly other codes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1176873860417660957?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1176873860417660957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-end-statement-state.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1176873860417660957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1176873860417660957'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-end-statement-state.html' title='Translator – End Statement State'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5427787254818596394</id><published>2011-03-18T22:13:00.000-04:00</published><updated>2011-03-18T22:13:54.776-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – Define Function Token Issues</title><content type='html'>For now in the process operand routine, define function with parentheses tokens will not be allowed in command or assignment mode. This will need to be changed later when the DEF command is implemented. This check was also made in the check assignment list item routine.&lt;br /&gt;&lt;br /&gt;However, since a define function without a parentheses token is allowed in assignments, the error was set to point to the open parentheses as an "&lt;i&gt;expected equal or comma for assignment&lt;/i&gt;" error. The open parentheses is at the end of the token, so to get the error to point to it, the column of the token was incremented by the length of the token minus one.&lt;br /&gt;&lt;br /&gt;Previously in the close parentheses token handler, the reference flag was being set for token with parentheses and define function with parentheses tokens. This check was modified to only set the reference flag for token with parentheses.&lt;br /&gt;&lt;br /&gt;The reference flag for define function without parentheses tokens was already being set, so no change was needed for these tokens.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5427787254818596394?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5427787254818596394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-define-function-token.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5427787254818596394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5427787254818596394'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-define-function-token.html' title='Translation – Define Function Token Issues'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4822299461390800280</id><published>2011-03-17T22:14:00.000-04:00</published><updated>2011-03-17T22:14:00.209-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Language'/><title type='text'>Language – Define Functions</title><content type='html'>Before defining what needs to be done with define function tokens in the Translator, a quick review of their syntax is required. The will be two forms of define functions that will be supported, a single line and a multiple line. An example of a single line define function would be:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DEF FNHypot(X,Y)=SQR(X*X+Y*Y)&lt;/span&gt;&lt;/blockquote&gt;Notice that this form has the same format as an assignment except for the DEF command at the beginning. The define function token in this statement is &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;FNHypot(&lt;/span&gt;&lt;/b&gt; - in other words, a define function with parentheses. This implies that a define function with parentheses token could appear in assignment mode (assuming the DEF command sets this mode), but only for the DEF command. An example of the multiple line form of the same function would be:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DEF FNHypot(X,Y)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FNHypot=SQR(X*X+Y*Y)&lt;br /&gt;END DEF&lt;/span&gt;&lt;/blockquote&gt;The assignment of the define function name (a define function without a parentheses) returns the value for the function. Here a define function without a parentheses can appear in an assignment statement, but only inside a DEF/END DEF block. Since the Translator is not aware of blocks, it will permit an assignment of define function without a parentheses token. It will be the Encoder's job to verify if the assignment is valid.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4822299461390800280?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4822299461390800280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/language-define-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4822299461390800280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4822299461390800280'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/language-define-functions.html' title='Language – Define Functions'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4658183481594098964</id><published>2011-03-16T21:00:00.000-04:00</published><updated>2011-03-16T21:00:42.836-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – Assignment Token Issues</title><content type='html'>Finally, some issues were discovered when making the change from command mode to assignment after processing an operand token. There are two main types of operand tokens, ones with parentheses and ones without parentheses.&lt;br /&gt;&lt;br /&gt;The operand tokens with parentheses include internal functions, defined user functions (DEF FN) and generic tokens with parentheses (which can be arrays or user functions). Internal functions were already invalid for command or assignment mode except for sub-string functions. A check was added for defined functions with parentheses.&lt;br /&gt;&lt;br /&gt;The operand tokens with no parentheses include internal functions with no arguments (currently only RND), constants, define user functions with no arguments, and generic tokens with no parentheses (which can be variables or user functions with no arguments). Internal functions and constants were already invalid because they didn't have the reference flag set when the comma or equal token looked for the reference flag. That left define function tokens...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4658183481594098964?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4658183481594098964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-assignment-token-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4658183481594098964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4658183481594098964'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-assignment-token-issues.html' title='Translation – Assignment Token Issues'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-589387944569423159</id><published>2011-03-15T22:44:00.000-04:00</published><updated>2011-03-15T22:44:14.703-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – Command Token Issues</title><content type='html'>The last problem statements related to unexpected command tokens were:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A PRINT B&lt;br /&gt;MID$(A$ PRINT,4)=""&lt;/span&gt;&lt;/blockquote&gt;The first statement gave an “&lt;i&gt;expected operator or end-of-statement&lt;/i&gt;” error at the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;B&lt;/span&gt;&lt;/b&gt; token. The second statement was actually accepted, but with a strange translation. The problems were caused because when the PRINT command token was received, it was immediately pushed to the command stack because the mode was still set to command.&lt;br /&gt;&lt;br /&gt;Both statements start as assignment statements, but assignment mode was not being set (unless preceded by the LET keyword). When an equal token is received expression mode is set, or when a comma token is received assignment list mode is set. The “&lt;i&gt;unexpected command&lt;/i&gt;” error was only occurring when the mode was not set to command, which didn't occur with the statements above. Also, this message again does fit with the “&lt;i&gt;expected ...&lt;/i&gt;” type of message.&lt;br /&gt;&lt;br /&gt;Once a command token is received in command mode, the mode is set according to the token mode in the command's table entry. A change was made to the process operand routine that once an operand token is processed, if in command mode, the operand is assumed the beginning of an assignment statement and so the mode is changed to assignment.&lt;br /&gt;&lt;br /&gt;To remove the “&lt;i&gt;unexpected command&lt;/i&gt;” error and report a more appropriate error, the command token has to be passed through the rest of the Translator. This will occur when the Translator is not in command mode. So the main add token routine was changed to not report this error if a command token is received and the mode is not command.&lt;br /&gt;&lt;br /&gt;Command tokens received in operand state were already being reported correctly since commands are also considered operators, which are not valid operands (unless the operator is a unary operator, which commands are not). Commands are considered operators because some commands can be found where an operator is expected, for example, THEN and ELSE.&lt;br /&gt;&lt;br /&gt;Commands tokens received in operator state are only valid if they have a token handler. In the process operator routine, when an operator token does not have a token handler a default operator token handler is called. Before the default operator token handler is called, a check was added to return an appropriate error if the token is a command.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-589387944569423159?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/589387944569423159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-command-token-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/589387944569423159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/589387944569423159'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-command-token-issues.html' title='Translation – Command Token Issues'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1359573849299612281</id><published>2011-03-13T21:33:00.000-04:00</published><updated>2011-03-13T21:33:00.790-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – Other Errors</title><content type='html'>After changing the “&lt;i&gt;item cannot be assigned&lt;/i&gt;” to “&lt;i&gt;expecting item for assignment&lt;/i&gt;” error, there were several other errors that didn't fit the “expecting ...” type of message. It turned out that most of these were not actually being used, so there were removed.&lt;br /&gt;&lt;br /&gt;Another remaining message was the “&lt;i&gt;missing open parentheses&lt;/i&gt;” error that occurs when there is a &amp;nbsp;parentheses with no open parentheses, function or array. After some consideration of possibly leaving this message as is, it was decided to change this to an “&lt;i&gt;expected operator or end-of-expression&lt;/i&gt;” error since the problem could also be a missing function or array, or even that the open parentheses was just a mistake.&lt;br /&gt;&lt;br /&gt;Again assuming that everything is correct up to the problem, this change seemed appropriate, and “&lt;i&gt;...expression&lt;/i&gt;” was used instead of “&lt;i&gt;...statement&lt;/i&gt;” because the next token could be a comma or semicolon in a PRINT statement or a THEN in an IF statement.&lt;br /&gt;&lt;br /&gt;The last message was the “&lt;i&gt;unexpected command&lt;/i&gt;” error that occurs when there is a command token when not in command mode. However, there were a number of additional problems with command tokens received when not expected...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1359573849299612281?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1359573849299612281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-other-errors.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1359573849299612281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1359573849299612281'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-other-errors.html' title='Translation – Other Errors'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-494428242871116660</id><published>2011-03-13T17:16:00.000-04:00</published><updated>2011-03-13T17:16:47.878-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – Parentheses Issue</title><content type='html'>The next problem statement was:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;MID$((A$),4)=""&lt;/span&gt;&lt;/blockquote&gt;This was reported as an “&lt;i&gt;item cannot be assigned&lt;/i&gt;” error and then crashed. Again, this error didn't fit the “&lt;i&gt;expected ...&lt;/i&gt;” messages. This error is also returned for statements like &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;3=A&lt;/span&gt;&lt;/b&gt; and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;1,A=B&lt;/span&gt;&lt;/b&gt; and was renamed to the “&lt;i&gt;expecting item for assignment&lt;/i&gt;” error. For the statement above, the “expecting string variable” error should be returned.&lt;br /&gt;&lt;br /&gt;The crash occurred because the open parentheses token was returned for the error with its range extended to the closing parentheses to report the entire &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;(A$)&lt;/span&gt;&lt;/b&gt;. The caller deleted the error token since it was an open parentheses to prevent a memory leak. However, in this case, the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;A$&lt;/b&gt;&lt;/span&gt; token was still on top of the done stack &lt;i&gt;with&lt;/i&gt; the open parentheses attached as the first operand. When the Translator clean up routine (called upon an error) was emptying the done stack, it deletes each item's first and last operand – the open parentheses was getting deleted twice causing the crash.&lt;br /&gt;&lt;br /&gt;Initially to fix this problem, when an error occurs and the first through last operand is returned, the first operand pointer for the item on the done stack was set to null to prevent it from being deleted a second time. While this fix was sufficient for the statement above, this statement still were not being reported correctly:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;MID$(-A$,4)=""&lt;/span&gt;&lt;/blockquote&gt;The error was “exp&lt;i&gt;ected numeric expression&lt;/i&gt;” pointing to the A$. Both the open parentheses and the minus are initially processed in the process unary operator routine. So a check was added to this routine to return an error if there is a sub-string function on top of the hold stack with its reference flag set (sub-string assignment) and it is as the first operand. Both of theses statements then correctly reported “&lt;i&gt;expected string variable&lt;/i&gt;” at the open parentheses and minus. The initial fix was not necessary since the error was being caught sooner.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-494428242871116660?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/494428242871116660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-parentheses-issue.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/494428242871116660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/494428242871116660'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-parentheses-issue.html' title='Translation – Parentheses Issue'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8375728717334035881</id><published>2011-03-12T22:59:00.003-05:00</published><updated>2011-03-12T23:00:50.806-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – Another Print Function Issue</title><content type='html'>While the new reference mode was being implemented, some problems were discovered in the code that carefully constructed statements would exploit giving incorrect results. The first problem statement was:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;TAB(10)=A&lt;/span&gt;&lt;/blockquote&gt;This caused a “&lt;i&gt;command stack empty for expression&lt;/i&gt;” bug error. This should have been “&lt;i&gt;expecting command&lt;/i&gt;” error. The check was if the command stack was empty or there was a PRINT command on top of the command stack or if the top of the hold stack was not empty (except for the null token).&lt;br /&gt;&lt;br /&gt;The error occurred when trying to get the type of expression because the hold stack was empty (first item to figure out the expression type) so it when to the command stack, which was also empty. This check should not have caught this because there was a check after this with for catching all internal functions in command mode. The check was modified to if the command stack is not empty and if there is a PRINT on top of the command stack or the hold stack is not empty.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8375728717334035881?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8375728717334035881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-another-print-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8375728717334035881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8375728717334035881'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-another-print-function.html' title='Translation – Another Print Function Issue'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4105447176185189839</id><published>2011-03-10T22:00:00.002-05:00</published><updated>2011-03-11T19:59:19.633-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Reference Mode</title><content type='html'>A new token mode is needed for the INPUT commands. The current token modes are command, assignment, assignment list and expression. Consider these invalid INPUT statements:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;INPUT A+B*C&lt;br /&gt;INPUT A+B*C$&lt;/span&gt;&lt;/blockquote&gt;The INPUT commands must have variables, not expressions. If expression mode was used, at each comma and the end of the statement, the INPUT command handler would need to check the token on top of the done stack to see if its reference flag is set. The first statement above, the INPUT command handler will see the multiplication token on top of the stack. Its first token will be &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A&lt;/span&gt;&lt;/b&gt; and last token will be &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C&lt;/span&gt;&lt;/b&gt;. An “&lt;i&gt;expecting variable&lt;/i&gt;” error would be reported pointing to the whole &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A+B*C&lt;/span&gt;&lt;/b&gt; expression. This would be acceptable.&lt;br /&gt;&lt;br /&gt;However, in the second statement, an error occurs before the INPUT command handler gets a chance to report an error. When the multiplication token checks its second operand, it will report an “&lt;i&gt;expecting numeric expression&lt;/i&gt;” error pointing at the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$&lt;/span&gt;&lt;/b&gt; token. This would make no sense. The proper error for both of these statements would be an “&lt;i&gt;expecting semicolon, comma or end-of-statement&lt;/i&gt;” error pointing at the add token.&lt;br /&gt;&lt;br /&gt;The new reference mode will only accept variables and array elements, specifically tokens with no parentheses and tokens with parentheses. If these tokens turn out to be user functions, which the Translator cannot determine, the error will be reported by the Encoder. Reference mode will be set when the INPUT command is received and after the comma or semicolon of the prompt string expression of the INPUT PROMPT command. It will also be used later for the READ command.&lt;br /&gt;&lt;br /&gt;In reference mode, internal functions, define functions, and unary operators will be reported as invalid (“&lt;i&gt;expecting variable&lt;/i&gt;” error). After the variable or array element token is pushed to the done stack, the state will be set to &lt;b&gt;end expression&lt;/b&gt; so that only end expression tokens are valid. Binary operators will then be correctly be reported as invalid.&lt;br /&gt;&lt;br /&gt;While reference mode was being implemented, some more problems were found in the Translator code...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4105447176185189839?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4105447176185189839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-reference-mode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4105447176185189839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4105447176185189839'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translator-reference-mode.html' title='Translator – Reference Mode'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8505707986528184265</id><published>2011-03-06T09:48:00.000-05:00</published><updated>2011-03-06T09:48:06.145-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – PRINT Function Problem</title><content type='html'>Due to the problems found with the print codes, some additional error tests were added to translator test 10 (PRINT statement tests) including these statements:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PRINT (TAB(10))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PRINT INT(TAB(10))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PRINT A(TAB(10))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PRINT A+TAB(10)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PRINT TAB(10)+A&lt;/span&gt;&lt;/blockquote&gt;The first three test the situation of a print function inside a parentheses, internal function and an array or user function, which were caught by adding count stack is not empty check when a print function token is received.&lt;br /&gt;&lt;br /&gt;In the fourth statement, the error can be caught by checking if the hold stack is not empty (an empty hold stack has only a null token). In this case, an operator will be on top of the hold stack. In fact, this check can replace the count stack is not empty check because the open parentheses, internal function and array/user function will be on top of the hold stack.&lt;br /&gt;&lt;br /&gt;The last statement was more difficult to check for - the expression should end after the print function. When the operator was received and checked its operand, a bug occurred because the done stack is empty since the print function didn't get pushed to the done stack. The error should be “&lt;i&gt;expected semicolon, comma or end-of-statement&lt;/i&gt;” and point to the operator.&lt;br /&gt;&lt;br /&gt;To catch this error, a new &lt;b&gt;end expression&lt;/b&gt; state was added. The closing parentheses is received when in &lt;b&gt;binary operator&lt;/b&gt; state. After the closing parentheses, the state was left at &lt;b&gt;binary operator&lt;/b&gt; since another binary operator is expected (an end of expression token is acceptable as a binary operator). For the &lt;b&gt;end expression&lt;/b&gt; state, only operators with the end expression flag are acceptable, which currently include the semicolon, comma and end-of-line tokens – other operators will generate the error.&lt;br /&gt;&lt;br /&gt;In resolving these issues, the “&lt;i&gt;invalid used of print function&lt;/i&gt;” error did not match the other “&lt;i&gt;expecting...&lt;/i&gt;” errors (remember the goal is to help the user by suggesting what is expected at the location of an error). Therefore, this error was changed to be one of the “&lt;i&gt;expecting xxx expression&lt;/i&gt;” depending on the current expression type (xxx would be blank, &lt;i&gt;numeric&lt;/i&gt; or s&lt;i&gt;tring&lt;/i&gt;).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8505707986528184265?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8505707986528184265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-print-function-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8505707986528184265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8505707986528184265'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-print-function-problem.html' title='Translation – PRINT Function Problem'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2122693633165872059</id><published>2011-03-05T18:01:00.002-05:00</published><updated>2011-03-05T18:01:42.943-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translation – PRINT Code Issues</title><content type='html'>The process final operand currently doesn't push print codes to the done stack. This needs to be expanded to include the input begin prompt codes. It would be inconvenient not to keep expanding this test to include additional codes that don't need to be pushed to the done stack. The check could be changed to see if the code does not have a return data type (it is set to none). This would include the print codes, the input begin codes, the input parse type codes, the input assign type codes, and probably many more.&lt;br /&gt;&lt;br /&gt;However, when this change was made, it did not work for the TAB and SPC print functions because the token data type for these had been incorrectly set to double. This occurred in the set default data type function when the token was received. This function was fixed to not set the data type for internal functions (these are set from their table entry data type).&lt;br /&gt;&lt;br /&gt;Now when the token's data type is none, it won't be pushed to the done stack. The check if the command on top of the command stack is the PRINT command only applies to print functions, but is not necessary here as this check was already made when the print function was first received, so the check was removed. The check if the token's has the print flag remains (to set the stay and print function command flags, which is used by the print command handler to determine if the final print code should be appended to the output).&lt;br /&gt;&lt;br /&gt;For the print type codes, when process final operand routine is called by the add print code routine, the second token passed is a null, not a closing parentheses. The process final operand was deleting the second token for print functions assuming that it was a closing parentheses (which only applies to TAB and SPC). For some reason, doing a delete with a null argument was not causing a problem. None the less, a check was added to only delete the second token if it is not a null.&lt;br /&gt;&lt;br /&gt;Another problem was discovered for print functions. The situation if a TAB or SPC was contained within parentheses, internal function, or and array/user function, was not caught since it was only checking if there was a print command. Therefore, an additional check was added to make sure the count stack is also empty.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2122693633165872059?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2122693633165872059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-print-code-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2122693633165872059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2122693633165872059'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/translation-print-code-issues.html' title='Translation – PRINT Code Issues'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2539504645909079603</id><published>2011-03-03T22:31:00.000-05:00</published><updated>2011-03-03T22:31:00.437-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>INPUT Translation – Some Issues</title><content type='html'>As the INPUT command handler was being implemented, some issues were found. When the new element pointer was added to the command item, it was noticed that there was a code member. This member is no longer needed because the token now contains the code (replacing the index member, through the code is now an index), so the code member was removed from the command item.&lt;br /&gt;&lt;br /&gt;There was no table entry for the two word INPUT PROMPT command, so one was added along with the three input begin codes. It was noticed that some table entries still had the string flag set. This is not necessary because the string flag is now set automatically during table initialization it there are any string arguments, so these string flags were removed.&lt;br /&gt;&lt;br /&gt;To look up which input begin code to append for the INPUT PROMPT command, the process final operand routine will be called, which in turn will call the find code routine that will pick the correct code based on the type (string or temporary string) that is on the done stack. The input begin codes will not push anything to the done stack (accomplished by setting the done push flag to false). Some additional issues were found in these routines...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2539504645909079603?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2539504645909079603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/input-translation-some-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2539504645909079603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2539504645909079603'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/input-translation-some-issues.html' title='INPUT Translation – Some Issues'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2861576936034683294</id><published>2011-03-02T21:48:00.000-05:00</published><updated>2011-03-02T21:48:00.652-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>INPUT Translation – Variables</title><content type='html'>Processing variables is a bit more complicated. With the PRINT statement, the appropriate print value type code was simply appended to the output. However, with the INPUT statement, an input parse code needs to be inserted after the begin code or after last parse code (before all of the variables), and an input assign code needs to be appended to the end of the output (after the variable).&lt;br /&gt;&lt;br /&gt;There needs to be a way to point to the location where the input parse codes are to be inserted. This will be accomplished with a new output list element pointer member to the command stack item. This pointer will be initialized to null when a new command token is pushed to the command stack.&lt;br /&gt;&lt;br /&gt;When an input begin code is appended to the output, this new element pointer will be set to the input begin code element. This pointer can also be used to indicate if any input variables have been received yet (when it does not contain a null).&lt;br /&gt;&lt;br /&gt;To insert a input parse code, the input parse token will be appended to the list at (after) this element pointer. The element pointer will then be set to the output list element of the input parse token just inserted so that the next input parse token will be inserted after this input parse token.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2861576936034683294?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2861576936034683294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/input-translation-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2861576936034683294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2861576936034683294'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/03/input-translation-variables.html' title='INPUT Translation – Variables'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8273201922533078491</id><published>2011-02-28T21:24:00.002-05:00</published><updated>2011-02-28T21:24:00.650-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>INPUT Translation – Beginning</title><content type='html'>Execution of the INPUT command has been defined and therefore the form of the translation, the actual process of the translation can now be defined. The translation begins with one of the InputBegin codes, which will be triggered by a comma or semicolon token. The INPUT or INPUT PROMPT token will already be on top of the command stack.&lt;br /&gt;&lt;br /&gt;For the INPUT command, when the first comma, a semicolon or an end-of-line token is received, an InputBegin token will be appended to the output. The token received can be converted to the InputBegin token (more efficient to change the token than to delete the token not needed and then create a new one).&lt;br /&gt;&lt;br /&gt;For the INPUT PROMPT command, when a comma or semicolon token is received, there must be a string on top of the done stack (the prompt string expression). Depending on whether this string is temporary or not will determine whether an InputBeginStr or InputBeginTmp will be appended to the output. For InputBeginStr, the string will be attached since the translator will not know if it is a variable, array or a user function. The token received can be converted to this token. An end-of-line token at this point would produce an “&lt;i&gt;expected comma or semicolon&lt;/i&gt;” error.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8273201922533078491?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8273201922533078491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-translation-beginning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8273201922533078491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8273201922533078491'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-translation-beginning.html' title='INPUT Translation – Beginning'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2816082550580507517</id><published>2011-02-27T16:28:00.001-05:00</published><updated>2011-02-27T16:28:37.952-05:00</updated><title type='text'>Automatic Code Enumeration Generation</title><content type='html'>To have the Code enumeration generated automatically from the table entries, the table source was structured so the awk scripts can read it. Since the Code enumeration value will now be the same as the table entry index, the code member of the table entry is not necessary and was removed. The code name initializers in the table entries was moved to a comment on the line of the entries' open brace.&lt;br /&gt;&lt;br /&gt;The awk scripts were rewritten to read the table source file instead of the main include file. The awk script were also changed to read the table source file directly and write the output files directly. This eliminates the requirement to redirect the input and output to the correct files when running the awk scripts. Logic was also added to the codes awk script to check for duplicate code names.&lt;br /&gt;&lt;br /&gt;The code to index conversion array that was initialized in the table class constructor, along with the check for duplicate and missing codes, was removed. The code and index access functions in the table class were also removed. The token class index member was replaced with a code member. All the code was updated to use the code enumeration value instead of the index, though the code will be used as an index.&lt;br /&gt;&lt;br /&gt;One problem with using an &lt;i&gt;enumeration&lt;/i&gt; value instead of an &lt;i&gt;integer&lt;/i&gt; index is that normal math functions cannot be used, like the add and increment operators. These operators are needed, so operator functions were created for the code enumeration, which includes the add, prefix increment and postfix increment operators. These functions type cast to integer to add and then type cast back to the code enumeration value.&lt;br /&gt;&lt;br /&gt;The null code entry at the end of the table was moved to the beginning so that that null code enumeration value (index) would be zero. The table search function for searching for an immediate command previously assumed that the immediate commands were at the beginning of the table entry array. Moving the null code to be the beginning of the array complicated this. Therefore, immediate command bracketing codes were put around these entries for this search function.&lt;br /&gt;&lt;br /&gt;Due to the these table entry changes, the parser test output files were updated since all the code indexes changed. This would be a good time to make another pre-release, but since there have been no download activity for recent pre-releases, there will not be a pre-release at this time. Now the translation of the INPUT command can begin...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2816082550580507517?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2816082550580507517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/automatic-code-enumeration-generation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2816082550580507517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2816082550580507517'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/automatic-code-enumeration-generation.html' title='Automatic Code Enumeration Generation'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-6067177050397455221</id><published>2011-02-26T16:35:00.000-05:00</published><updated>2011-02-26T16:35:31.593-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Execution'/><title type='text'>Code Enumeration vs. Table Entry Indexes</title><content type='html'>While designing the error handling mechanism for the INPUT command, a thought occurred related to program codes. For efficient program execution at run-time, the index of the table entry will be stored in the internal program code, not the code enumeration value.&lt;br /&gt;&lt;br /&gt;If the code enumeration value was used, the index for the table entry (needed to get the run-time handler function pointer) would first need to be converted to an index by going through the code to index array setup during table initialization. The intention all along has been to use table entry indexes in the internal program code.&lt;br /&gt;&lt;br /&gt;For the INPUT command's error recovery, when it is backing up execution and checking for input parse codes, it will need to convert the table entry indexes to a code before it can check if it is an input parse code. This would not efficient during program execution. Even though for the INPUT command, execution time is not critical since it is about to stop and wait for user input. A few extra program cycles won't matter much. But this problem could occur for other more critical commands.&lt;br /&gt;&lt;br /&gt;Therefore, it is desirable if the code enumeration values were the same as the table entry indexes. One simple solution is to make sure the code enumeration values matched the table entries. Unfortunately this relies on the programmer to keep the two in sync, is very error prone and is just a general pain to begin with.&lt;br /&gt;&lt;br /&gt;There is a better way where the code enumeration is generated automatically from the table entries using an awk script. This method would be similar to how the test_codes.h file (used by the test_ibcp.cpp source file) is generated automatically by scanning for codes in the ibcp.h file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-6067177050397455221?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/6067177050397455221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/code-enumeration-vs-table-entry-indexes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6067177050397455221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6067177050397455221'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/code-enumeration-vs-table-entry-indexes.html' title='Code Enumeration vs. Table Entry Indexes'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-947013503763018927</id><published>2011-02-26T08:45:00.000-05:00</published><updated>2011-02-26T08:45:50.539-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Execution'/><title type='text'>INPUT Execution – Error Handling</title><content type='html'>Errors can occur while parsing the input – in one of the input parse codes. When an error occurs, after it is reported, the already parsed values in the temporary input values stack need to be thrown away and execution needs to resume at the beginning of the INPUT statement, except instead of issuing the prompt again, the cursor will be positioned at the beginning of the input, which will contain the previously erroneous input to allow the user to correct the input instead of reentering it (the traditional “&lt;i&gt;redo from start&lt;/i&gt;”).&lt;br /&gt;&lt;br /&gt;The temporary input values stack can't simply be reset (setting the internal index to -1, the empty stack indicator) because elements may contain allocated string values, which need to be deleted to prevent memory leaks. Like the evaluation stack, the elements in the temporary input values stack won't have any indicator what data type they are. Consider the basic format of the INPUT statement (only up to the parsing codes is shown):&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;InputBegin InputParse&lt;i&gt;Type1&lt;/i&gt; InputParse&lt;i&gt;Type2&lt;/i&gt; InputParse&lt;i&gt;Type3&lt;/i&gt;'End' ...&lt;/span&gt;&lt;/blockquote&gt;Say an error occurs on the second parse code (the program execution pointer will be pointing at next code, the InputParse&lt;i&gt;Type3&lt;/i&gt;, in other words, the pointer is incremented after reading each program code word, then the code read is executed by calling its run-time handler). Execution needs to be backed up until the InputBegin is reached (reading the program codes in reverse).&lt;br /&gt;&lt;br /&gt;As each code is passed, one element will be popped from the temporary input values stack. If the code passed is an InputParseStr code, then the element popped is a string that needs to be deleted. The beginning is reached when a non input parse code is reached (it could be InputBegin, InputBeginStr or InputBeginTmp). &amp;nbsp;The stack will now be empty.&lt;br /&gt;&lt;br /&gt;The INPUT begin code will be executed again and the begin code will call the get input routine. The get input routine will normally allocates the temporary input values stack. For error recovery, it will see that the stack is already allocated, so instead of outputting the prompt and saving the cursor position to the beginning of the input, it will restore the saved cursor position and get the input starting with the previously entered erroneous input. Execution will then resume with the corrected input.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-947013503763018927?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/947013503763018927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-error-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/947013503763018927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/947013503763018927'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-error-handling.html' title='INPUT Execution – Error Handling'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8034182492340906672</id><published>2011-02-25T21:51:00.006-05:00</published><updated>2011-02-26T08:47:16.092-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Execution'/><title type='text'>INPUT Execution – Temporary Values</title><content type='html'>The values parsed from the entered input to be assigned to the input variables need to be stored somewhere other than the evaluation stack. The logical place is another temporary input values stack. This stack will be allocated and initialized in the get input routine and will be removed by the final INPUT command code.&lt;br /&gt;&lt;br /&gt;After a value is parsed by one of the input parse codes, it will be saved (pushed) to a temporary input values stack. At the last input parse code (with the 'End' sub-code), an index to be used to access this stack will be set to zero. As each value is assigned by an input assign code, this index will be incremented. In other words, this stack is being used as First-In-First-Out out list instead of a Last-In-First-Out standard stack.&lt;br /&gt;&lt;br /&gt;The SimpleStack (to be renamed to just Stack since there is no other class named Stack), does not currently have this mechanism. This will be added when the run-time code implemented, but it is not needed currently for translating the INPUT command, so this addition will wait.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8034182492340906672?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8034182492340906672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-temporary-values.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8034182492340906672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8034182492340906672'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-temporary-values.html' title='INPUT Execution – Temporary Values'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2778628369855626444</id><published>2011-02-24T22:18:00.004-05:00</published><updated>2011-02-24T22:18:00.350-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Execution'/><title type='text'>INPUT Execution Codes – Ending</title><content type='html'>There will be the final INPUT command code at the end of the input statement. Besides cleaning up, the only action that needs to be performed is to advance to the next line if the 'Keep' sub-code is not set (this sub-code is set when there is a semicolon at the end of the INPUT statement). In summary, the “INPUT I%,A(I%)” statement will be translated as:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;InputBegin InputParseInt InputParseDbl'End' I%&amp;lt;ref&amp;gt; InputAssignInt I% A(&amp;lt;ref&amp;gt; InputAssignDbl Input&lt;/span&gt;&lt;/blockquote&gt;As usual for RPN format, the command is at the end of the translation. What remains to be designed is where the temporary input values will be stored and how errors will be handled. An error can occur in the parsing codes. When an error occurs, execution must go back to the InputBegin, however, the prompt does not need to be output again, the cursor only needs to be positioned back where is was after the prompt was output (after the error is reported).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2778628369855626444?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2778628369855626444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-codes-ending.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2778628369855626444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2778628369855626444'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-codes-ending.html' title='INPUT Execution Codes – Ending'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1219271150315664900</id><published>2011-02-23T21:15:00.002-05:00</published><updated>2011-02-24T17:04:56.323-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Execution'/><title type='text'>INPUT Execution Codes - Assigning</title><content type='html'>The assigning of the input values must be done separately from the parsing of the values entered due to the two input rules. For the example, this is steps 7 through 11. Some of these steps are standard expression codes: push a reference to an integer variable (step 7), push a value to an integer variable (step 9), and calculating a reference to an array element by popping a integer subscript value and pushing the reference to the element (step 11).&lt;br /&gt;&lt;br /&gt;There will be a code to assign an input value to an input variable for each data type: InputAssignInt, InputAssignDbl and InputAssignStr. For InputAssignStr, the InputParseStr will created a string from the input value. This string will be assigned to the string variable replacing the previous string value, which will be deleted. Therefore, there will be no need to deal with temporary strings.&lt;br /&gt;&lt;br /&gt;The values being assigned will need to stored temporarily somewhere other than the evaluation stack.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1219271150315664900?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1219271150315664900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-codes-assigning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1219271150315664900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1219271150315664900'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-codes-assigning.html' title='INPUT Execution Codes - Assigning'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2089023280071738908</id><published>2011-02-22T21:59:00.001-05:00</published><updated>2011-02-22T21:59:00.615-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Execution'/><title type='text'>INPUT Execution Codes - Parsing</title><content type='html'>The parsing of the entered input values must be done separately from the assignment of the values entered to the input variables. This a departure from the design previously described and is due to the two input rules. For the example, this is steps 3 through 6. Notice that after a value is parsed (steps 3 and 5), a check is made for the next character. This character must be a comma after each value except for the last value where an end-of-line (no character) is expected.&lt;br /&gt;&lt;br /&gt;There will be a code to parse an input value for each data type: InputParseInt, InputParseDbl and InputParseStr. An 'End' sub-code will be set on the last parse code. If this sub-code is not set, then the next character must be a comma, otherwise an end-of-line (no character) is expected.&lt;br /&gt;&lt;br /&gt;The values that are parsed need to be put somewhere. If input values were pushed on to the evaluation stack, then when the references to the input variables are pushed, the input values would be down the stack and would not be easily accessible. Therefore, the evaluation stack can't be used.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2089023280071738908?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2089023280071738908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-codes-parsing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2089023280071738908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2089023280071738908'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-codes-parsing.html' title='INPUT Execution Codes - Parsing'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4631948817904163705</id><published>2011-02-21T22:07:00.010-05:00</published><updated>2011-02-22T10:12:50.611-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Execution'/><title type='text'>INPUT Execution Codes - Prompting</title><content type='html'>Execution and translation of the INPUT command was previously described mostly in posts on &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2010/06/translation-input-command-revised.html"&gt;June 24, 2010&lt;/a&gt;, &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2010/06/execution-input-command-revised.html"&gt;June 25, 2010&lt;/a&gt; and &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2010/06/translator-input-command.html"&gt;June 27, 2010&lt;/a&gt; . This now needs to be revised since the execution broke the two rules listed at the end on &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-input-command-new-problem.html"&gt;February 16, 2011&lt;/a&gt;. Steps 1 and 2 handle issuing the prompt and getting input from the user. This is almost the same as previously defined, which are these codes:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;InputBegin &amp;nbsp; &amp;nbsp;&lt;/span&gt;– output default prompt and get input&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;InputBeginStr &lt;/span&gt;– output string prompt and get input&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;InputBeginTmp &lt;/span&gt;– output string prompt, get input and delete temporary string&lt;/blockquote&gt;During execution, the run-time handlers for each of these codes will call a common routine for getting input. This common get input routine can also handle outputting the prompt and can simply use the string on top of the evaluation stack. There will be an argument for whether to output the prompt string on top of the stack and InputBegin will set this argument to false.&lt;br /&gt;&lt;br /&gt;There will be another argument for whether to output the default prompt where InputBegin will set this to true and the other two will set to true if the 'Question' sub-code is set (if the prompt string expression was followed by a comma instead of a semicolon).&lt;br /&gt;&lt;br /&gt;For InputBeginTmp, the temporary string can be deleted upon returning from the get input routine since it will no longer be needed with the improvement in execution described in last Saturday's posts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4631948817904163705?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4631948817904163705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-codes-prompting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4631948817904163705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4631948817904163705'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-execution-codes-prompting.html' title='INPUT Execution Codes - Prompting'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1920806397628597872</id><published>2011-02-19T15:38:00.001-05:00</published><updated>2011-02-19T15:39:25.081-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Execution'/><title type='text'>INPUT Command – Execution Procedure</title><content type='html'>To determine how the INPUT command will be encoded into internal memory, the internal codes need to be arranged according to how the INPUT command will be executed including handling errors. Using the same “&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;INPUT I%,A(I%)&lt;/span&gt;&lt;/b&gt;” example statement from before, here is the procedure (for the moment without taking into account error handling):&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Issue prompt (for this statement, the default “&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;? &lt;/span&gt;&lt;/b&gt;” prompt)&lt;/li&gt;&lt;li&gt;Get the input from the user (allowing for editing like backspace, cursor left/right, insert/overwrite, delete, and terminated by enter)&lt;/li&gt;&lt;li&gt;Parse an integer value from the input&amp;nbsp;for &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; and save it (&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; can't actually be assigned yet)&lt;/li&gt;&lt;li&gt;Check if the next character in the input is a comma&lt;/li&gt;&lt;li&gt;Parse a double value from the input&amp;nbsp;for &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A(I%)&lt;/span&gt;&lt;/b&gt; and save it (&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A(I%)&lt;/span&gt;&lt;/b&gt; can't be assigned yet since &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; hasn't been assigned)&lt;/li&gt;&lt;li&gt;Check if there are no more characters&lt;/li&gt;&lt;li&gt;Push reference of &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; to evaluation stack&lt;/li&gt;&lt;li&gt;Assign saved integer value to reference on top of stack – &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Push value of &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; to evaluation stack (&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; has now been assigned)&lt;/li&gt;&lt;li&gt;Calculate reference for array A by popping index from evaluation stack, push calculated reference, &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A(I%)&lt;/span&gt;&lt;/b&gt;, to stack&lt;/li&gt;&lt;li&gt;Assign saved double value to reference on top of stack – &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A(%)&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;End of INPUT command, advance to next line of output&lt;/li&gt;&lt;/ol&gt;Codes need to be defined for these steps. Some of these steps are already standard token types, step 7 is &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&amp;lt;ref&amp;gt;&lt;/span&gt;&lt;/b&gt;, step 9 is &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt;, and step 10 is &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A(&amp;lt;ref&amp;gt;&lt;/span&gt;&lt;/b&gt;. The rest of the steps will be INPUT command related codes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1920806397628597872?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1920806397628597872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-command-execution-procedure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1920806397628597872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1920806397628597872'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-command-execution-procedure.html' title='INPUT Command – Execution Procedure'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-3776409815385162001</id><published>2011-02-19T07:51:00.002-05:00</published><updated>2011-02-19T07:51:25.669-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Language'/><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><title type='text'>INPUT Command – Execution Improvement</title><content type='html'>An improvement can be made to the execution of the INPUT command that will simplify the execution and will work nicer from the user standpoint. The traditional implementation of the INPUT command was designed to work with Teletypes. This has no place on modern computers. This has to do with what happens when the input entered by the user is invalid.&lt;br /&gt;&lt;br /&gt;After surveying several BASIC implementations, all do a form of “Redo from start” on a new line and then reissuing the prompt on another new line for the input again and forcing the user to start their input from the beginning. Many of the implementations don't even check the presence for all the values requested or even accept string values and then simply set the non-entered or invalid values to zero. This is very sloppy programming and forces the programmer to do more work validating input.&lt;br /&gt;&lt;br /&gt;A better alternative is to properly parse and validate the input entered. If something isn't valid, then output a temporary error message, point to where the error is (so the user doesn't have to guess what was wrong) and then allow the user to edit their input. Using extra output lines is unnecessary. The error message will be removed from the screen when INPUT is done. This also simplifies run-time in that the prompt string does not need to be saved until the end of the INPUT statement (deleting it if is a temporary string) since it now only needs to be output once.&lt;br /&gt;&lt;br /&gt;There are other enhancements that can be made to the INPUT command, like having a fixed length input field with an optional template and accepting special exit keys (function keys, escape, page up/down, arrow up/down, etc) that the programmer can check for, but this will be later once the project is up and running. For now, the translation of current INPUT command needs to be implemented. As always, before the translation can be implemented, some idea how the INPUT command will work at run-time is needed to determine what tokens need to be put into the RPN output list.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-3776409815385162001?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/3776409815385162001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-command-execution-improvement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3776409815385162001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3776409815385162001'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/input-command-execution-improvement.html' title='INPUT Command – Execution Improvement'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2348546617405337863</id><published>2011-02-16T21:13:00.000-05:00</published><updated>2011-02-16T21:13:30.041-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Input Command'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – INPUT Command – New Problem</title><content type='html'>A few new ideas for the INPUT command have been developed that may simplify the execution of the INPUT command and work better than traditional implementation (more on this in a bit). Upon reviewing the previous &lt;a href="http://interactivebasiccompilerproject.blogspot.com/search/label/Input%20Command"&gt;posts&lt;/a&gt;&amp;nbsp;on the INPUT command and reading the ANSI Standard document for the INPUT command again, a problem was discovered with the previous design. The problem can be shown with this INPUT statement:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;INPUT I%,A(I%)&lt;/span&gt;&lt;/blockquote&gt;This is probably bad programming - if the value entered is outside the range of the array, an exception occurs. In any case, it is allowed. Both GW-Basic and QBASIC act as expected where the first value entered becomes the index of the element that is assigned the second value. &amp;nbsp;However, the design laid before won't act as expected. Consider the planned translation for this statement:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;InputGet I%&amp;lt;ref&amp;gt; InputInt I% A( InputDbl Input&lt;/span&gt;&lt;/blockquote&gt;This will not work, consider the items pushed to the evaluation stack upon reaching the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Input&lt;/span&gt;&lt;/b&gt; code at the end:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Input information (prompt is specified, question flag, and location)&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;I%&amp;lt;ref&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Parsed integer value from input&lt;/li&gt;&lt;li&gt;Pointer to the integer assign routine&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;A(I%)&amp;lt;ref&amp;gt;&lt;/b&gt;&lt;/span&gt; (after &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;I%&lt;/b&gt;&lt;/span&gt; pushed, popped and reference to &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;A(I%)&lt;/b&gt;&lt;/span&gt; calculated)&lt;/li&gt;&lt;li&gt;Parsed double value from input&lt;/li&gt;&lt;li&gt;Pointer to the double assign routine&lt;/li&gt;&lt;/ol&gt;Notice in item 5 that the value of &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; used to calculated the reference to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A(I%)&lt;/span&gt;&lt;/b&gt; would not be the value of &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; just parsed from the input because &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;I%&lt;/span&gt;&lt;/b&gt; has not been assigned yet, which would occur after all of the input has been parsed and found to be valid. Making the implementation difficult are two rules that must be followed:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Can't put references to the evaluation stack until previous values have been assigned.&lt;/li&gt;&lt;li&gt;Can't assign any variables to the input values until the entire input has been parsed and validated.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2348546617405337863?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2348546617405337863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-input-command-new-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2348546617405337863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2348546617405337863'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-input-command-new-problem.html' title='Translator – INPUT Command – New Problem'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8848058237378408737</id><published>2011-02-14T20:53:00.002-05:00</published><updated>2011-03-25T19:57:08.329-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pre-Release'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Restructure Pre-Release</title><content type='html'>Since the restructuring of the code was significant, it is probably a good time to make a pre-release of the code before commencing with the INPUT command. The file &lt;a href="http://sourceforge.net/projects/ibcp/files/Translator%20Dev.%20Releases/ibcp_0.1.15-pre-1-src.zip/download"&gt;ibcp_0.1.15-pre-1-src.zip&lt;/a&gt; has been uploaded at &lt;a href="https://sourceforge.net/projects/ibcp/files/"&gt;Sourceforge IBCP Project&lt;/a&gt; along with the binary for the program. When uploading these files, it was discovered that the &lt;a href="http://sourceforge.net/projects/ibcp/files/ibcp_0.1.14-src.zip/download"&gt;ibcp_0.1.14-src.zip&lt;/a&gt; was missing the complete set of test files, and so was uploaded again. The shell script used to automatically generate a release was using the wrong list to generate the source zip file. Now on to the INPUT command (finally)...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8848058237378408737?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8848058237378408737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-restructure-pre-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8848058237378408737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8848058237378408737'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-restructure-pre-release.html' title='Translator – Restructure Pre-Release'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-9167786226703878247</id><published>2011-02-13T20:08:00.001-05:00</published><updated>2011-02-13T20:09:32.545-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – More Code Restructuring</title><content type='html'>It turns out there were really no more issues, just some minor bugs that needed to be corrected. However, in looking at the error messages, the “expected statement” just didn't seem to be as clear as it could be and so was changed to “expected command” along with the name of the corresponding token status.&lt;br /&gt;&lt;br /&gt;The size of the &lt;b&gt;add token&lt;/b&gt; routine has been getting out of hand for some time. It's not really a good idea to let a function get so big because it becomes much harder to understand and maintain. So it is time to break it up into smaller functions. Generally, no variables need to be passed between these functions except for a reference to the token pointer and token status (usually the return value). The &lt;b&gt;add token&lt;/b&gt; function was broken up into these functions:&lt;br /&gt;&lt;blockquote&gt;&lt;b&gt;process operand&lt;/b&gt; – handles operands when in operand status and token is not an operator&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;end expression error&lt;/b&gt; – gets the error when an expression is ended prematurely (an end expression token is received in operand state) and is only called when the state is not first operand&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;process unary operator&lt;/b&gt; – handles the checking if an operator token is a unary operator received in operand state including processing open parentheses tokens&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;process binary operator&lt;/b&gt; – handles tokens when in binary operator state&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;process_operator&lt;/b&gt; – empties higher precedence operators from hold stack adding them to the output list (functionality merged with the add operator function, which was removed since it only contains a few lines), then calls the token handler for the operator token&lt;/blockquote&gt;Now the code will be a bit more manageable as the INPUT and other commands are implemented.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-9167786226703878247?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/9167786226703878247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-more-code-restructuring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/9167786226703878247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/9167786226703878247'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-more-code-restructuring.html' title='Translator – More Code Restructuring'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2821040436187724371</id><published>2011-02-12T09:25:00.002-05:00</published><updated>2011-02-12T09:25:41.612-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – PRINT and Assign Restructuring</title><content type='html'>Only the PRINT and Assign commands commands are implemented so far, which were restructured where the related code for these commands contained in the comma and semicolon tokens was relocated into the command handlers. These token handlers will now call the command handlers just like the end-of-line token handler does. A switch was added to the command handlers on the code of the token passed in. Previously this token was only the end-of-line token.&lt;br /&gt;&lt;br /&gt;The code from the end-of-line token handler that called a command handler was moved to a new call command handler routine that does as described in the last post except at the beginning, a check was added if the command stack is empty. This condition can occur in an assignment statement before a comma or equal token has been received. A null token status will be returned for the caller to report the appropriate error.&lt;br /&gt;&lt;br /&gt;For the comma token handler, a null token status can only occur in expression only test mode because this mode does not put a command on the command stack. For the semicolon token handler, a null token status can occur if the semicolon is at the beginning of the line (where a command is expected) or after a variable (where a comma or equal is expected). The same conditions don't occur at a comma because there are specific checks depending on the current mode (command, assignment list or expression), where as the semicolon doesn't check the mode.&lt;br /&gt;&lt;br /&gt;For the PRINT command handler, the code related code was moved moved from these token handlers into the appropriate cases of the switch. Since no other tokens are currently expected, the default case was set to return an unexpected token bug error.&lt;br /&gt;&lt;br /&gt;The Assign Command handler only expects an end-of-line token, so for the default case, the assignment list mode returns a equal or comma expected error and expression mode returns an operator or end of statement expected error when expecting a binary operator or a numeric or string expression expected error when expecting an operand. Before returning the error, the command item token needed to be set to the token passed in to point the error to the token causing the error.&lt;br /&gt;&lt;br /&gt;A few other issues were discovered after the code was restructured and tested...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2821040436187724371?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2821040436187724371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-print-and-assign.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2821040436187724371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2821040436187724371'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-print-and-assign.html' title='Translator – PRINT and Assign Restructuring'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-7232326188280108842</id><published>2011-02-09T21:18:00.002-05:00</published><updated>2011-02-09T21:18:47.330-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Token/Command Handler Restructuring</title><content type='html'>While looking over the design notes for the INPUT and INPUT PROMPT commands, besides implementing a new INPUT command handler, parts would also be implemented in the Comma and Semicolon token handlers just like the PRINT command. As further commands are implemented, these token handlers will increase in size. The code to handle a command will be located in several different routines. A better design would be if all of the command is processed in a single routine – the command handler.&lt;br /&gt;&lt;br /&gt;The EOL token handler already calls the command handler, where each currently assumes that it is called for an EOL token. The code that would be in the comma and semicolon token handlers could be moved to the command handler, which would have a switch on the code of the token passed in to perform the appropriate action. Then the comma and semicolon token handlers would also call a command handler. If the command doesn't support the passed token, then it would return an error.&lt;br /&gt;&lt;br /&gt;There is a sequence of code to call a command handler: get the command item from on top of the command stack, get the command token's command handler from the table, return an error if there is no handler in the table, call the command handler, if it returns an error then check if the command handler changed the token (for the error) and if is has delete the original token passed, and set the error token to return. This sequence will be put into a new call command handler routine so the code is not repeated in each token handler.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-7232326188280108842?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/7232326188280108842/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-tokencommand-handler.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7232326188280108842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7232326188280108842'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-tokencommand-handler.html' title='Translator – Token/Command Handler Restructuring'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-84885870159271213</id><published>2011-02-08T20:50:00.001-05:00</published><updated>2011-03-25T08:54:15.915-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><category scheme='http://www.blogger.com/atom/ns#' term='Release'/><title type='text'>Translator – Expression Type Release</title><content type='html'>The changes in getting the expression type code working correctly are completed. The plan was that the next official release would include support for INPUT, but that was before the issue of checking expression types came up when considering the reporting of errors with the string operand of the INPUT PROMPT command.&lt;br /&gt;&lt;br /&gt;This is also the first release since development was moved from VIDE2 (using Insight, a GUI for gdb, for debugging) to NetBeans (which includes a GUI front end to gdb). A make file was developed so that NetBeans is not required to build the program for the project. &amp;nbsp;The program is build by simply issuing the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make&lt;/span&gt;&lt;/b&gt; command in the main IBCP directory.&lt;br /&gt;&lt;br /&gt;All of the test programs were also modified to work using the same make file. The VIDE2 project files were removed. The test programs are built using the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make tests&lt;/span&gt;&lt;/b&gt; command. A specific test can be built, for example the stack test program is built with the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;make test_stack&lt;/span&gt;&lt;/b&gt; command. The parser and table test programs were removed as there functionality is now built into the main IBCP program.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://sourceforge.net/projects/ibcp/files/ibcp_0.1.14-src.zip/download"&gt;ibcp_0.1.14-src.zip&lt;/a&gt;&amp;nbsp;file has been uploaded at &lt;a href="https://sourceforge.net/projects/ibcp/files/"&gt;Sourceforge IBCP Project&lt;/a&gt; along with the binary for the program. This release contains the complete current source including the test programs and a single make file for building the main program and optionally the test programs. It is recommended that the source be extracted into a clean directory. Now the INPUT command can be implemented...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-84885870159271213?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/84885870159271213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-expression-type-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/84885870159271213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/84885870159271213'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-expression-type-release.html' title='Translator – Expression Type Release'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4403572587010110636</id><published>2011-02-07T21:27:00.000-05:00</published><updated>2011-02-07T21:27:00.275-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Assignments and INSTR</title><content type='html'>While debugging assignments of temporary strings, specifically the assignment of a string that needs to be attached to the assignment operator, done stack empty errors were occurring. This was caused because it was trying to attach two strings, only one of which was on the done stack. Somehow the number of strings member in the table entry was set to two – it appeared to be counting both operands even though a check was put in not to count the first operand of an assignment operator (and was working).&lt;br /&gt;&lt;br /&gt;The problem was finally determined to be caused by the INSTR table entries. The assignment operator table entries and the INSTR table entries were sharing the same expression information structure instance. When the assignment operator entry was initialized, it properly set the number of strings to one. But when it processed the INSTR table entries, it changed the number of strings to two, since it was the same instance. This was corrected by giving the assignment operator entries their own instances of the expression information structure.&lt;br /&gt;&lt;br /&gt;This corrected the assignment operator problem, but the INSTR functions were giving an “&lt;i&gt;expected operator or close parentheses&lt;/i&gt;” error at the second comma of the three argument form of INSTR. This occurred because the associated INSTR codes (Instr2T1, Instr2T2 and Instr2TT) did not have the multiple flag set. This was corrected by setting the multiple flag in the T1, T2 and TT forms of the Instr2 code entries, and the Instr3 associated code entries were placed after each of their corresponding Instr2 codes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4403572587010110636?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4403572587010110636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-assignments-and-instr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4403572587010110636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4403572587010110636'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-assignments-and-instr.html' title='Translator – Assignments and INSTR'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-7924339200622531338</id><published>2011-02-06T21:06:00.000-05:00</published><updated>2011-02-06T21:06:08.785-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Assignment Table Entries</title><content type='html'>&amp;nbsp;The assignment operator table entries previously only had one operand, which was used for both the variable(s) being assigned and for the expression being assigned, since there both the same data type. This did not work for temporary strings because the variable operand needed to a string and operand being assigned needed to be a temporary string. So, the assignment operators were given two operands, the first for the variable(s) being assigned and the second for the operand of the assignment.&lt;br /&gt;&lt;br /&gt;This change caused a problem with the main assign and assign list operators, which contained the list of all the related associated assignment operator codes (one for each data type). When find code is processing the assignment operand (the second operand) for double assignment, it does not need search for associated codes. To stop this, the index to the second set of associated codes, needed to be set to the number of associated codes, but this caused the Table initialization check to fail. So this initialization was modified to accept this condition.&lt;br /&gt;&lt;br /&gt;The Table initialization was also modified to not count the first string operand for assignment operators (the entry's reference flag is set) because the string variable(s) being assigned are not attached to the assign string operator.&lt;br /&gt;&lt;br /&gt;One strange problem remained with assignments, which involved the INSTR table entries...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-7924339200622531338?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/7924339200622531338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-assignment-table-entries.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7924339200622531338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7924339200622531338'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-assignment-table-entries.html' title='Translator – Assignment Table Entries'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8128018195688682164</id><published>2011-02-06T18:12:00.002-05:00</published><updated>2011-02-06T18:12:09.804-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Assignments of Temporary Strings</title><content type='html'>A problem with assignments of temporary strings was that the assignment command handler was not performing all the actions it needed to. These additional tasks were found be comparing to the process final operand routine, which it turned out could be used with some special allowances for assignment operators.&lt;br /&gt;&lt;br /&gt;The code in the assignment command handler was replaced with a call to the process final operand routine except for the check if the done stack is empty (needed otherwise the find code routine would flag it as a bug with its empty done stack check) and the clearing of the reference flag of the assignment operator token.&lt;br /&gt;&lt;br /&gt;In the process final operand routine, a check was added if the token's table entry has the reference flag set (set only for assignment operators), then the assignment operator token will not be put onto the done stack, though it will still get operands attached (strings, but not temporary strings), and any parentheses in the first and last operands of the token being assigned are deleted.&lt;br /&gt;&lt;br /&gt;There were additional problems with the Table entries for the assignment operators...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8128018195688682164?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8128018195688682164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-assignments-of-temporary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8128018195688682164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8128018195688682164'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-assignments-of-temporary.html' title='Translator – Assignments of Temporary Strings'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2641780465214901800</id><published>2011-02-05T19:09:00.000-05:00</published><updated>2011-02-05T19:09:19.676-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Temporary String Support - Debugging</title><content type='html'>The Parser tests expected results needed to be updated because the EOL code had changed (due to extra table entries being added). Several of the Translator tests expected results needed to be updated for the new temporary string codes. For example, the convention for the operators are CatStr: &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$&lt;/span&gt;&lt;/b&gt;, CatStrT1: &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$1&lt;/span&gt;&lt;/b&gt;, CatStrT2: &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$2&lt;/span&gt;&lt;/b&gt;, and CatStrTT: &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$T&lt;/span&gt;&lt;/b&gt;. The convention for functions is a T added to the function name, for example Len: &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;LEN(&lt;/span&gt;&lt;/b&gt; and LenTmp: &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;LENT(&lt;/b&gt;&lt;/span&gt;. The INSTR functions with two string arguments use the convention &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;T1&lt;/span&gt;&lt;/b&gt;, &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;T2&lt;/span&gt;&lt;/b&gt; and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;TT&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Some minor table entries problems were fixed, but one significant problem that needed correcting was in the number of strings member in the expression information structure in each table entry. This member is automatically calculated during table initialization, but was counting both string and temporary string operands. This field is used to determine how many strings need to be popped from the done stack and attached. Temporary strings are not left on the done stack, so the number of strings should have only included the number of strings only, not temporary strings.&lt;br /&gt;&lt;br /&gt;There was one other issue with constant strings. Technically these are already known to be strings, unlike tokens with and without parentheses that may be variables/arrays or user functions. Therefore, constants don't need to be attached to operands. But there is no allowance in the current implementation for this, so to keep things simple, they will continue to be attached. The proper code is already set (for a string operand), and the Encoder will see that they are constants and leave the code as is. Normally, if the Encoder determines that an operand is user function, meaning it produces a temporary string, it will change the code appropriately to one that has a temporary string operand.&lt;br /&gt;&lt;br /&gt;There is still a problem with assignments...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2641780465214901800?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2641780465214901800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-temporary-string-support.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2641780465214901800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2641780465214901800'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-temporary-string-support.html' title='Translator – Temporary String Support - Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-3166337912181467311</id><published>2011-02-05T09:28:00.000-05:00</published><updated>2011-02-05T09:28:01.387-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Full Temporary String Support</title><content type='html'>The main work for adding full support for temporary string includes adding all the new codes for temporary strings and adding all the table entries for these new codes. Part of this was adding new operand arrays that contain the temporary string type(s), adding new associated arrays and increasing the maximum size of the associated array (the assign and assign list associated arrays contain five associated codes).&lt;br /&gt;&lt;br /&gt;For example, previously there was the CatStr code (both operands are strings). This was expanded to the CatStrT1 (first operand is a temporary string), CatStrT2 (second operand is a temporary string), and CatStrTT (both operands are strings) codes. The is similarly for functions. For example, previously there was the Len code (argument is a string). This was expanded to the LenTmp (argument is a temporary string). The INSTR function that takes two arguments, the T1/T2/TT format was used.&lt;br /&gt;&lt;br /&gt;The sub-string functions don't need to be expanded, because their operands are transferred to the next operator or function. If their operand is a string, then the next operator or function will be one that takes a string operand. If their operand is a temporary string, then the next operator or function will be one that takes a temporary string (that would need to be deleted at run-time when it is no longer needed). Therefore, there does not need to be separate codes (one that takes a string and a temporary string).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-3166337912181467311?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/3166337912181467311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-full-temporary-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3166337912181467311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3166337912181467311'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-full-temporary-string.html' title='Translator – Full Temporary String Support'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-3231125428229807806</id><published>2011-02-03T21:23:00.000-05:00</published><updated>2011-02-03T21:23:30.494-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – No Array Assignments</title><content type='html'>Tokens with parentheses can be either an array or a user function, but the Translator can't determine which since it doesn't have access to the Dictionary (the repository for all elements of the program including variables, arrays, defined functions, user functions, constants, etc. with information about each). The Dictionary will be developed along side the Encoder. For now, the Translator will simply &lt;i&gt;translate&lt;/i&gt; from the input code entered to reverse polish notation.&lt;br /&gt;&lt;br /&gt;It was thought that since a token with parentheses on the left side of an assignment can only be an array, that the Translator could &lt;i&gt;assume&lt;/i&gt; that it was an array and handle the subscripts accordingly. Currently the Translator just attaches all the operands (subscripts) to these tokens. The Encoder (by looking up the identifier in the Dictionary to determine what it is) will handle arrays and user functions. For arrays, all the subscripts need to be numerical (doubles would get a CvtInt added) and for functions, the arguments must match the function definition.&lt;br /&gt;&lt;br /&gt;There is one additional issue with arrays through that the Encoder will handle, which is to check if the number of subscripts is correct for the array. This information will be in the Dictionary, which the Translator does not have access to. If arrays were assumed, the current attachment of subscripts, including the number of subscripts attached, would not include. The Encoder would then not know how many subscripts were found (which needs to be checked) unless this number was somehow passed through. Therefore, the current mechanism will be left in place. The only thing left to the expression type processing is to add full support for temporary strings...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-3231125428229807806?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/3231125428229807806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-no-array-assignments.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3231125428229807806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3231125428229807806'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-no-array-assignments.html' title='Translator – No Array Assignments'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-7733177997628098338</id><published>2011-02-02T21:23:00.002-05:00</published><updated>2011-02-02T21:23:55.418-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Array Assignments</title><content type='html'>There's been a change of plan for the Translator handling arrays on the left side of assignment statements, which will be explained in the next post. What was needed to handle array subscripts was a stripped down routine similar to the code routine, to handle integers and doubles (for which a hidden CvtInt code would be added). As the customized new function was being implemented, some unnecessary code was found.&lt;br /&gt;&lt;br /&gt;In the find code routine, when the token with an error was not a reference, there was a check if the last token added to the output was different from the token on the done stack, and if it was, it was assumed that the last token was a sub-string function (which was not put on the done stack because its operand was left on the done stack). So this sub-string token was returned for the error instead of the token on top of the done stack.&lt;br /&gt;&lt;br /&gt;In addition, if the last token was not the expected sub-string function, a bug error was returned since it was assumed to be invalid condition. However, this is a valid condition if a dummy close parentheses token was added to the output, which would then be the last token added to the output.&lt;br /&gt;&lt;br /&gt;With the first and last operand implementation, these checks are no longer necessary, since the for sub-string functions, the first operand left on the done stack acquires the sub-string function token as its first operand and this first operand token is returned as the location of the error. &amp;nbsp;Therefore, these extra checks were removed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-7733177997628098338?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/7733177997628098338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-array-assignments.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7733177997628098338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7733177997628098338'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-array-assignments.html' title='Translator – Array Assignments'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-6195934201676816488</id><published>2011-02-01T20:02:00.003-05:00</published><updated>2011-02-02T09:29:28.590-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Memory Leaks'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Correcting More Token Leaks</title><content type='html'>There were a few more token leaks that needed to corrected, one with the first and last operand changes and rest with the PRINT command. Details of the rest of the token leaks found and corrected are after the continue. All tokens leaks have now been corrected, time to handle array assignments...&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;When processing the final operand for operators and internal functions, the setting of the first and last operands was handled for &lt;i&gt;non-&lt;/i&gt;sub-string internal functions and operators. For non-reference sub-string functions, the sub-string function doesn't get pushed to the done stack, but the first operand on the done stack (the operand of the sub-string function) is set to the sub-string function and the last operand is set to the closing parentheses.&lt;br /&gt;&lt;br /&gt;However, &lt;i&gt;reference&lt;/i&gt; sub-string functions are pushed to the done stack, but the first and last operands were never set and so were left set to the last argument's first and last operands. The first operand should have been cleared (to be the sub-string function like other internal functions) and the last operand should have been set to the closing parentheses token passed in. Also, no operands should be attached to the sub-string function (it is already known to be a string variable).&lt;br /&gt;&lt;br /&gt;In the print command handler, at the end of the statement, the print token is only added to the output to cause the cursor to be moved to the next line (the statement does not end with a semicolon, comma or print function, which keep the cursor on the same line). In this case, the print token was not used but it was not being deleted.&lt;br /&gt;&lt;br /&gt;When processing the final operand for print functions (SPC and TAB), which don't get pushed to the done stack, the closing parentheses token of the function was not being deleted.&lt;br /&gt;&lt;br /&gt;In the semicolon token handler, when the semicolon sub-code was set, the semicolon token was not being deleted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-6195934201676816488?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/6195934201676816488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-correcting-more-token-leaks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6195934201676816488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6195934201676816488'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/02/translator-correcting-more-token-leaks.html' title='Translator – Correcting More Token Leaks'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5397170226727661414</id><published>2011-01-30T19:37:00.002-05:00</published><updated>2011-01-30T19:38:13.585-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Memory Leaks'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Correcting Token Leaks</title><content type='html'>The crash on Translator test 12 was caused because the token leaks were only being output after a successful translation but not when an error was reported. After a number of errors, the token leaks built up and when they were finally output, their information didn't line up with the current input line causing a crash when accessing outside of a buffer. Once that problem was fixed, the token memory leaks were fixed one by one.&lt;br /&gt;&lt;br /&gt;For one of the leaks, an incorrect fix was applied causing multiple token deletes. For some reason these tokens were not output. A segmentation fault occurred when attempting to debug this problem before it even got to the output code when it was attempting to delete the string in the token a second time. Setting the string pointer to NULL didn't help – apparently the memory was already being used for something else.&lt;br /&gt;&lt;br /&gt;Apparently gdb (under NetBeans) catches these segmentation faults where the program running by itself does not. In any case, at least the code was at least detecting the extra delete condition. &amp;nbsp;Details of the memory leaks found and corrected so far after the continue. A common theme is that the token leaks occur when something is popped from the stack and not put anywhere because any tokens in any of the stacks, the pending parentheses token or the output list get deleted by the Translator's cleanup routine.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;- - - - - -&amp;nbsp;- - - - - -&amp;nbsp;- - - - - -&amp;nbsp;- - - - - -&amp;nbsp;- - - - - -&lt;br /&gt;In the comma token handler, the comma token was not deleted when an argument to an internal function was the wrong expression type.&lt;br /&gt;&lt;br /&gt;In the closing parentheses token handler, the top token was popped from the done stack, but if error occurs, the error is pointing to the close parentheses token and the top token was forgotten. The code was changed to only pop the top token when no error occurs.&lt;br /&gt;&lt;br /&gt;In the closing parentheses token handler, the closing parentheses token was not deleted when an argument to an internal function was the wrong expression type.&lt;br /&gt;&lt;br /&gt;In the assignment command handler, if the operand being assigned was the wrong expression type, the first and last operands from the item on top of the done stack are used to report the error. However, it didn't call the delete open and close parentheses routines for the first and last operands if there was no expression type error – the first and last operands were no longer needed.&lt;br /&gt;&lt;br /&gt;When checking the item on top of the done stack in an assignment list, if the item was an array or sub-string, it had a closing parentheses set as its last operand, which was not getting deleted.&lt;br /&gt;&lt;br /&gt;Before a new operator is processed, any higher precedence operators on the hold stack are popped first to added to the output list. If an error occurs (like the operand for the higher precedence operator is the wrong expression type), both the operator from the hold stack and the new operator tokens were not deleted - the token returned was the operand with the error.&lt;br /&gt;&lt;br /&gt;When a range of tokens is reported for an error, the first operand token is returned with its length modified to include all the tokens through the last operand token. However, the last operand was not deleted if it was a closing parentheses when the operand from the done stack was popped.&lt;br /&gt;&lt;br /&gt;When processing the first operand of an operator, if the first operand was the wrong expression type, then the first operand of the operator is returned for the error, but the original operator token was not deleted.&lt;br /&gt;&lt;br /&gt;When an error occurs, the caller of the Translator (the test code) was only deleting the token passed to the Translator if it was the original token passed, otherwise the token was assumed to be a stack or output list and would be deleted by the Translator clean up routine. An open parentheses token was an exception because these are temporarily used as first operand tokens, so if this was the token with the error, the open parentheses token was not deleted. The delete open parentheses routine was used since it has all the proper checks to delete this token (this function was made public to be accessible).&lt;br /&gt;&lt;br /&gt;In the end-of-line token handler, the command token was popped from the command stack before the check if the command handler called returned an error. When an error occurred, the command token was not deleted. The command token pop was moved to after the error check so that the command token will still be on the command when the clean up routine is called.&lt;br /&gt;&lt;br /&gt;In the end-of-line token handler, when the command handler returned an error, if the token returned is different from the end-of-line token, the end-of-line token is not deleted. A check was added that if the token returned is a different toke, the end-of-line token is deleted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5397170226727661414?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5397170226727661414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-correcting-token-leaks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5397170226727661414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5397170226727661414'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-correcting-token-leaks.html' title='Translator – Correcting Token Leaks'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5089149202155173692</id><published>2011-01-29T23:18:00.000-05:00</published><updated>2011-01-29T23:18:12.487-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Memory Leaks'/><title type='text'>Token Leaks – Implementation</title><content type='html'>To implement token leak detection, a token pointer list was added to the Token class as a static member and a token list element pointer was added as a regular member. &amp;nbsp;The new and delete operators were overloaded in the Token class to be able to maintain this token list.&lt;br /&gt;&lt;br /&gt;The overloaded new operator function first allocates an array of bytes for the size argument, which is type cast to a Token pointer. The token pointer is appended to the static token pointer list and the element pointer returned from the list append function is put into the element pointer member of the token. The value of the token pointer is returned.&lt;br /&gt;&lt;br /&gt;The overloaded delete operator function type casts the void pointer to a token pointer. If the element pointer is NULL, then this token has already been deleted. Otherwise the element pointer in the token is used to remove the token pointer from the token pointer list. The element pointer of the token is set to NULL to indicate that it has been deleted (to detect multiple deletes of the same token). The memory used by the token is then deleted.&lt;br /&gt;&lt;br /&gt;This additional error that can occur when a token being deleted more than once. To also catch these errors, when a token is being deleted, if its element pointer is NULL, then a copy of the token will be added to a new delete list, which will be a list of tokens. A copy of the token needs to be made because the memory has already been deleted and could be reused by another allocation. It's also possible that the memory may have already been reused and the token copy will be garbage, but at least it will be known there is an extra delete somewhere.&lt;br /&gt;&lt;br /&gt;Finally, the test code was modified to output any tokens that have not been deleted once the RPN output list has been output and cleaned up (all of its tokens deleted). The tokens in the delete list are also output. Once the code was working and running, many token leaks were found (in six of the Translator tests), and Translator test 12 (more error tests) was crashing. Time to fix some problems...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5089149202155173692?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5089149202155173692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/token-leaks-implementation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5089149202155173692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5089149202155173692'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/token-leaks-implementation.html' title='Token Leaks – Implementation'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5892102044433352730</id><published>2011-01-29T17:38:00.000-05:00</published><updated>2011-01-29T17:38:42.547-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>List Class Update</title><content type='html'>The List class is currently keeping track of the beginning and end of the linked list with a master element. The master element is created when the list is created. A list element contains a previous element and next element link pointers along with the value of the element. The amount of memory allocated for the master element is less the element value using a strange syntax for subtracting the size of the value from the total size of the element – not ideal.&lt;br /&gt;&lt;br /&gt;When a list is created, the links of the master element are set to point to the master element itself. &amp;nbsp;The list is empty when the master element's next and previous pointers are the same as the master element pointer. When linking through the list, the first element is the master element's next pointer. The end of the list is detected when the master element is reached when linking to an element's next pointer.&lt;br /&gt;&lt;br /&gt;In considering a design for the token linked list, it was realized that the master element is not really necessary. All that is needed is a pointer to the first element in the list. Or, for a first-in-last-out list, a pointer to the last element. The last pointer method will be used and the variable will be named &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tail&lt;/span&gt;&lt;/b&gt;. The list is linked circularly meaning that the last element's next pointer points to the first element in the list and the first element's previous pointer points to the last element. If the list is empty, then &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tail&lt;/span&gt;&lt;/b&gt; will be set to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;NULL&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Using the single &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tail&lt;/span&gt;&lt;/b&gt; pointer, the first element in the list is now obtained using &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tail-&amp;gt;next&lt;/span&gt;&lt;/b&gt; assuming the list is not empty, otherwise &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;NULL&lt;/span&gt;&lt;/b&gt; will be returned. The last element is now obtained simply by using&amp;nbsp;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tail&lt;/span&gt;&lt;/b&gt;. When appending items to end of the list, the new element is linked into the list and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tail&lt;/span&gt;&lt;/b&gt; is set to the new element. When removing the last element from the list, a check is needed to see if the list is empty after removing the item.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5892102044433352730?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5892102044433352730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/list-class-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5892102044433352730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5892102044433352730'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/list-class-update.html' title='List Class Update'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5801237595412936319</id><published>2011-01-29T08:55:00.000-05:00</published><updated>2011-01-29T08:55:47.142-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Sourceforge Uploads Now Working</title><content type='html'>Sourceforge is accepting uploads again and the files for the latest pre-release are now there.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5801237595412936319?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5801237595412936319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/sourceforge-uploads-now-working.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5801237595412936319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5801237595412936319'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/sourceforge-uploads-now-working.html' title='Sourceforge Uploads Now Working'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-7540036093372391651</id><published>2011-01-28T23:59:00.000-05:00</published><updated>2011-01-28T23:59:42.588-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Memory Leaks'/><title type='text'>Token Leaks – Initial Design Thoughts</title><content type='html'>When considering a design to keep track of tokens created, there needed to be an easy way to remove the token once it has been deleted. Tokens left in the list would be memory leaks. The first idea was a simple linked list where each element consisted of a previous link, a next link, a pointer to the token and some type of identifier of where in the code that the Token was allocated. A pointer to the list element would be added to the Token class.&lt;br /&gt;&lt;br /&gt;When a token is created, it would be added to the list and a pointer to the list element would be put into the token. &amp;nbsp;When a token is deleted, it would use the element pointer to delete the item from the list. For tokens still in the list at the end, the identifier would indicate where the token was created, though the contents of the token itself would probably be sufficient in determining why it was not deleted.&lt;br /&gt;&lt;br /&gt;At first, a special token list class was considered. It would only need a pointer to the first element in the list. Some code on how this would work (adding and deleted elements) was sketched out. &amp;nbsp;But wait, there was already a List class, and then it was realized that the List class doesn't need a master element to keep track of the first and last elements in the list. Only a pointer to the first (or last) element is needed...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-7540036093372391651?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/7540036093372391651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/token-leaks-initial-design-thoughts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7540036093372391651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7540036093372391651'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/token-leaks-initial-design-thoughts.html' title='Token Leaks – Initial Design Thoughts'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2342341498999607085</id><published>2011-01-27T22:21:00.000-05:00</published><updated>2011-01-27T22:21:51.558-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Memory Leak Detection</title><content type='html'>Memory leaks have been a continual problem. Frequently another one is discovered like the recent pending parentheses issue. Some short of memory leak detection is needed. In C++, the new and delete operators can be overloaded so that a custom memory management can be used. While this is a possible solution, a memory manager with leak detection can be very involved. Something simpler is desired.&lt;br /&gt;&lt;br /&gt;Analyzing the current source code, looking for all the uses of new operators currently used, here's what was found:&lt;br /&gt;&lt;blockquote&gt;&lt;b&gt;Tokens&lt;/b&gt; – allocated in a number of places; these have been where most of the memory leaks have been found&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;Strings&lt;/b&gt; – for now these are allocated when creating tokens, so if the tokens get deleted these will get deleted (in the Token destructor)&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;Stacks&lt;/b&gt; – the arrays in the stacks upon first creation and when expanded; the arrays will be deleted when the stacks go out of scope (as part of the destructors of the classes that use them)&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;Lists&lt;/b&gt; – the elements of the list, which are deleted when the lists go out of scope (as part of the destructors of the classes that use them)&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;Translator Output list&lt;/b&gt; – this is a one time allocation in the Translator when a new translation is initiated; it is handed over to the caller when getting the translated results; so it's up to the caller to clean this up (currently handled in the test code)&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;RpnItems&lt;/b&gt; – everyone of these that are allocated is appended to the Translator's output list, so these will be handled when this list is cleaned up&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;Table&lt;/b&gt; – one time allocation in the main function, which is not important as there is only one, but a delete was added at the end of the main function&lt;/blockquote&gt;&lt;blockquote&gt;&lt;b&gt;Error Lists&lt;/b&gt; – these are allocated as part of the Token and Table initialization when an error is detected, but were never deleted, which is not important as these were only created when there was an error (and the program exits), but deletes were added&lt;/blockquote&gt;So it looks like Tokens are the only specific area where there is currently a problem with &amp;nbsp;memory leaks. Next, a simple solution for detecting token leaks...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2342341498999607085?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2342341498999607085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/memory-leak-detection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2342341498999607085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2342341498999607085'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/memory-leak-detection.html' title='Memory Leak Detection'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5748827547538817739</id><published>2011-01-27T05:50:00.001-05:00</published><updated>2011-01-27T05:56:26.423-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><title type='text'>Sourceforge Not Accepting New Uploads</title><content type='html'>Sourceforge does not appear to be accepting new uploads at the moment. &amp;nbsp;Last night it just seemed to be taking a long time to be distributed to the mirrors, but this morning the same message appeared. &amp;nbsp;&lt;a href="http://sourceforge.net/apps/wordpress/sourceforge/"&gt;This&lt;/a&gt; may explain the problem. &amp;nbsp;For some reason it did except the new release notes. &amp;nbsp;For now the previously posted link for the latest pre-release does not work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5748827547538817739?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5748827547538817739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/sourceforge-not-accepting-new-downloads.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5748827547538817739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5748827547538817739'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/sourceforge-not-accepting-new-downloads.html' title='Sourceforge Not Accepting New Uploads'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1818989423745793014</id><published>2011-01-26T21:56:00.008-05:00</published><updated>2011-02-27T16:36:49.922-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pre-Release'/><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – First/Last Operand – Pre-Release</title><content type='html'>The first and last operand changes are now working and all tests are working correctly except for three statements in Translator test 12 (more error tests). The expected results for these statements were changed in anticipation of having the Translator assume that tokens with parentheses on the left side of an assignment are arrays since functions with arguments will never be there. However, one little issue remains. Consider these statements:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = A$ + &lt;u&gt;(B + C)&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z = A + &lt;u&gt;(B$ + C$)&lt;/u&gt;&lt;/span&gt;&lt;/blockquote&gt;Because the open and close parentheses are now attached to operator tokens, the second + in the two statements above, when the error is detected (at this +), the whole parenthetical expression including the parentheses are reported instead of the expression within the parentheses. This new behavior is reasonable so it will be left as is for now.&lt;br /&gt;&lt;br /&gt;This is a good time to make another pre-release before continuing. The file &lt;span class="Apple-style-span"&gt;&lt;a href="http://sourceforge.net/projects/ibcp/files/Translator%20Dev.%20Releases/ibcp_0.1.14_Pre-Releases/ibcp_0.1.14-pre-4-src.zip/download" style="background-color: white;"&gt;ibcp_0.1.14-pre-4-src.zip&lt;/a&gt;&lt;/span&gt; has been uploaded at &lt;a href="https://sourceforge.net/projects/ibcp/files/"&gt;Sourceforge IBCP Project&lt;/a&gt;&amp;nbsp;along with the binary for the program. Now, before continuing on, it's time to do something about detecting memory leaks...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1818989423745793014?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1818989423745793014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand-pre.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1818989423745793014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1818989423745793014'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand-pre.html' title='Translator – First/Last Operand – Pre-Release'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2133862061654778165</id><published>2011-01-25T22:13:00.000-05:00</published><updated>2011-01-25T22:13:00.127-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – First/Last Operand – More on Parentheses</title><content type='html'>An old undiscovered bug was found where the pending parentheses token was not deleted when the previous token added to the output list's parentheses sub-code was set when it was determined that the parentheses was not necessary (the parentheses sub-code allows the parentheses to be reproduced). This again emphasizes the need for memory leak detection (more on this soon).&lt;br /&gt;&lt;br /&gt;There was a conflict between a closing parentheses token being used as a pending parentheses and as a last operand. It's possible that a pending parentheses will become a token added to the output list (occurs when there are two sets of unnecessary parentheses), so when this token is no longer needed as a last operand, it can't be deleted. The solution was for two new sub-codes, one where the closing parentheses token is being used for a pending parentheses (Used) and one where it is being used for a last operand (Last).&lt;br /&gt;&lt;br /&gt;When the pending parentheses is set, the token's Used sub-code is set. When a closing parentheses token is set as a last operand, the token's Last sub-code is set. When the pending parentheses token is no longer needed, if its Last sub-code is set, the Used sub-code will be cleared, otherwise the token will be deleted. If the pending parentheses is added to the output, its Used sub-code will be left set to prevent it from getting deleted. Similarly, when a closing parentheses token is no longer needed as a last operand, if its Used sub-code is set, its Last sub-code will be cleared, otherwise the token will be deleted.&lt;br /&gt;&lt;br /&gt;In the closing parentheses handler, when a closing parentheses is processed for a parenthetical expression, the opening parentheses (previously deleted) will now be set as the first operand and the closing parentheses (also set to the pending parentheses) will not be set as the last operand of the token on top of the done stack. The closing parentheses token's Last and Used sub-codes will be set.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2133862061654778165?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2133862061654778165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand-more-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2133862061654778165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2133862061654778165'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand-more-on.html' title='Translator – First/Last Operand – More on Parentheses'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-9076917409708223599</id><published>2011-01-22T22:11:00.000-05:00</published><updated>2011-01-22T22:11:26.971-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – First/Last Operand – Parentheses</title><content type='html'>Previously it was thought that parentheses could be ignored for the first and last operands because parentheses are always valid in a numeric expression or a string expression, though parentheses would be strange in string expression since there is currently only one string operator (concatenate), but still valid. However, consider this statement:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = A$ + -(B+C)&lt;/span&gt;&lt;/blockquote&gt;The entire &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-(B+C)&lt;/span&gt;&lt;/b&gt; sub-expression should be reported as an “expecting string expression” error. However, only the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;B+C&lt;/span&gt;&lt;/b&gt; is being reported before the unary operator fix and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-(B+C&lt;/span&gt;&lt;/b&gt; after this fix. In both cases, the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C&lt;/b&gt;&lt;/span&gt; was the last operand of the negate (where the expression type was invalid). The parentheses were removed. Had the statement been:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = A$ + INT(B+C)&lt;/span&gt;&lt;/blockquote&gt;The error would have been correctly reported since the closing parentheses is being attached to the last operand of the function. Therefore, both the open and closing parentheses also need to be carried through the operands.&lt;br /&gt;&lt;br /&gt;Currently, when a closing parentheses is processed, the open parentheses token is deleted and the closing parentheses is temporarily saved in the pending parentheses variable, which is checked later to see if it was necessary or not (the parentheses sub-code of the previous operand is set if the parentheses were unnecessary). To be continued...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-9076917409708223599?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/9076917409708223599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand_22.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/9076917409708223599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/9076917409708223599'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand_22.html' title='Translator – First/Last Operand – Parentheses'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2072592035722626059</id><published>2011-01-22T08:12:00.000-05:00</published><updated>2011-01-22T08:12:44.153-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – First/Last Operand – Unary Operators</title><content type='html'>Expression type errors involving unary operators were not pointing to the correct tokens. &amp;nbsp;This was caused because no operands were being attached to unary operators pushed to the done stack. Consider this statement:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = A$ + -B&lt;/span&gt;&lt;/blockquote&gt;The &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-B&lt;/span&gt;&lt;/b&gt;&amp;nbsp;tokens should be reported as an “&lt;i&gt;expecting string expression&lt;/i&gt;” error. However, only the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;B&lt;/span&gt;&lt;/b&gt;&amp;nbsp;token was being reported because the first and last operand of the negate operator was being set to the first and last operand of its operand from the done stack, which was the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;B&lt;/b&gt;&lt;/span&gt; token.&lt;br /&gt;&lt;br /&gt;The solution was to only attach the last operand from the operand popped from the done stack and leaving the first operand set to nothing of the unary operator token, which will cause the code to use the negate token itself as the first operand.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2072592035722626059?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2072592035722626059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand-unary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2072592035722626059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2072592035722626059'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand-unary.html' title='Translator – First/Last Operand – Unary Operators'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5782868400871220698</id><published>2011-01-21T21:37:00.002-05:00</published><updated>2011-01-22T11:13:14.109-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – First/Last Operand – Initial Debugging</title><content type='html'>Initially, all the Translator tests were failing. The source of the crash was the new delete close parentheses routine, which also needed to check if the token type has a table entry. The crash occurred because when token didn't have a table entry as it was trying to access the table entry to check for a close parentheses code.&lt;br /&gt;&lt;br /&gt;Next, a very old bug that went undiscovered was occurring in the expression only test mode used for the first four Translator tests. The problem was that the final result was left on the done stack and the Null token was left on the hold stack. The crash occurred &amp;nbsp;on the first error test when the cleanup routine was called and it tried checking for a close parentheses in the last operand – the token if was checking no longer existed. The End-of-line handler was modified to cleanup the stacks in expression mode and to check to make sure that there is only the result item on the done stack.&lt;br /&gt;&lt;br /&gt;A series of problems were then discovered relating to unary operators and parenthetical expressions. Also, a realization was made that the first and last operands need to be saved for operands of arrays and used functions so that the Encoder can report errors correctly for array subscripts and function arguments. More on these problems to follow...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5782868400871220698?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5782868400871220698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand-initial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5782868400871220698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5782868400871220698'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand-initial.html' title='Translator – First/Last Operand – Initial Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-7164456731175422067</id><published>2011-01-16T10:13:00.000-05:00</published><updated>2011-01-16T10:13:20.565-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – First/Last Operand Implementation</title><content type='html'>As the hold stack was being changed from holding just a token pointer to a structure containing a token, a first operand token and last operand token pointers, it was noticed that the end of the Operator and Equal (for the equality operator) token handlers contained almost identical code, both needing modified for the hold stack item change. The code was moved and replaced with a call to a new process first operand routine.&lt;br /&gt;&lt;br /&gt;A second token pointer argument was add to the process final operand routine, which is called to add a token to the output list by the add operator routine (to add an operator from the hold stack), add print code routine (to add a hidden print code for a specific data type), and the close parentheses token handler (to add a function or array from the hold stack). This second token pointer will contain the first operand token (from the add operator routine), nothing (from the add print code routine), or the close parentheses token (from the close parentheses token handler).&lt;br /&gt;&lt;br /&gt;The find code routine was modified to return the first and last operand token pointers from the operand on the done stack that is being checked. These arguments are pointers to token pointers with a null pointer default value – a caller only passes these when it needs them. The find code routine contains local pointer variables if the caller doesn't pass pointers since first and last operand tokens will be needed if an error occurs.&lt;br /&gt;&lt;br /&gt;The line in the close parentheses token handler that deletes the close parentheses token was removed (since this token is now being passed to the process final operand routine to be stored temporarily as the last token pointer for arrays and functions). Several locations need to delete this token when it is no longer needed. This procedure first needs to check if the last operand token pointer is set, if the token is a close parentheses token, and then needs to delete the token. A new delete close parentheses inline function was implemented that performs this procedure.&lt;br /&gt;&lt;br /&gt;Finally, a through inline function was implemented in the Token class that takes a second token argument and calculates the total length for a token that includes up through to this second token as described &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-errors-with-range-of-tokens.html"&gt;here&lt;/a&gt; and returns a pointer to the first token so that it can be conveniently assigned to the token being returned. &amp;nbsp;Now for debugging and testing...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-7164456731175422067?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/7164456731175422067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7164456731175422067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7164456731175422067'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-firstlast-operand.html' title='Translator – First/Last Operand Implementation'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5932702607702365318</id><published>2011-01-15T08:32:00.000-05:00</published><updated>2011-01-15T08:32:16.100-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Sub-String Functions</title><content type='html'>Sub-string functions add a wrinkle to storing the first and last token because these are not actually stored on the done stack (their string operand is kept on the stack). Consider this statement:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$= LEFT$(A$, 1) + B$ &amp;gt; C$&lt;/span&gt;&lt;/blockquote&gt;When the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$&lt;/span&gt;&lt;/b&gt; token is processed, the operand on the stack will be &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A$&lt;/span&gt;&lt;/b&gt; left there by the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;LEFT$(&lt;/span&gt;&lt;/b&gt; function, which will be considered the first operand of the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$&lt;/span&gt;&lt;/b&gt; token. This would then be passed on as the first operand of the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;$&lt;/span&gt;&lt;/b&gt; token. When the error is reported, the range will incorrectly be from &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A$&lt;/span&gt;&lt;/b&gt; to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$&lt;/span&gt;&lt;/b&gt; instead of &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;LEFT$(&lt;/span&gt;&lt;/b&gt; to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;To resolve this, when a sub-string function is processed (popped from the hold stack and added to the output list, but not put on the done stack where its string operand remains), the sub-string token will be put into its operand's first token on the done stack. If this token already has a first token, it will be overwritten.&lt;br /&gt;&lt;br /&gt;In the statement above, the first operand of &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A$&lt;/span&gt;&lt;/b&gt; will be set to the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;LEFT$(&lt;/span&gt;&lt;/b&gt; token. The &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$&lt;/span&gt;&lt;/b&gt; token will then inherit the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;LEFT$(&lt;/span&gt;&lt;/b&gt; as its first token, followed by the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;$&lt;/span&gt;&lt;/b&gt; token. When the error is finally reported, the range of tokens will correctly be from L&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;EFT$(&lt;/span&gt;&lt;/b&gt; to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$&lt;/span&gt;&lt;/b&gt;. Now on to the implementation of the first and last operand...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5932702607702365318?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5932702607702365318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-sub-string-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5932702607702365318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5932702607702365318'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-sub-string-functions.html' title='Translator – Sub-String Functions'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-9135792252089201965</id><published>2011-01-14T22:47:00.007-05:00</published><updated>2011-01-15T08:32:47.770-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Functions and Arrays</title><content type='html'>Reporting range of tokens (sub-expressions) gets a little more involved when arrays and functions (internal or user) are in the expression. Consider this statements:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = A$(1) + B$(2) &amp;gt; C$(3)&lt;/span&gt;&lt;/blockquote&gt;The range of tokens would be &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A$(&lt;/span&gt;&lt;/b&gt; to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$(&lt;/span&gt;&lt;/b&gt; and reporting only up to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$(&lt;/span&gt;&lt;/b&gt; would not be correct since the&amp;nbsp;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;3&lt;/span&gt;&lt;/b&gt; and&amp;nbsp;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;)&lt;/span&gt;&lt;/b&gt; tokens should be included. Therefore the closing parentheses of an array or function should be assigned the last token for an array or function token. This implies that closing parentheses tokens cannot not be immediately deleted.&lt;br /&gt;&lt;br /&gt;When the array or function token is popped from the done stack, if the last token is a closing parentheses, then it will be deleted, unless it is being assigned as the last operand to an operator token as would happen in the statement above, the closing parentheses to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$(&lt;/span&gt;&lt;/b&gt; would be assigned to the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;$&lt;/span&gt;&lt;/b&gt; token as its last token. When the error gets reported, the range would be from the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A$(&lt;/span&gt;&lt;/b&gt; token and the final&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; token of the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$(&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;There is no issue with regular parentheses expression as these are valid in any expression, therefore, if the statement above included parentheses around the expression, the error would be reported as (in other words, the parentheses are valid, but not the expression inside):&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = (A$(1) + B$(2) &amp;gt; C$(3))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;^^^^^^^^^^^^^^^^^^^^^-- expected string expression&lt;/span&gt;&lt;/blockquote&gt;This attachment of closing parentheses to tokens will take place in the closing parentheses token handler and will only apply to arrays and functions, not simple parentheses expressions. Also worth noting is that tokens (arrays and functions) will only have a last token assigned, the first token will be blank. In this case the token itself will be considered the first token. Finally, sub-string functions add another wrinkle to this scheme...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-9135792252089201965?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/9135792252089201965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-functions-and-arrays.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/9135792252089201965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/9135792252089201965'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-functions-and-arrays.html' title='Translator – Functions and Arrays'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-6363028996329124537</id><published>2011-01-13T22:07:00.004-05:00</published><updated>2011-01-15T08:33:04.112-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – First and Last Operand</title><content type='html'>When an error occurs, the inclusive range between the first and last tokens of the offending expression will be reported. Take the previous example statement &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$=A$+B$&amp;gt;C$&lt;/span&gt;&lt;/b&gt;. The &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;$&lt;/span&gt;&lt;/b&gt; token will be on top of the done stack when the expression type error is detected (the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;&amp;gt;$&lt;/b&gt;&lt;/span&gt; operator returns an integer and cannot be assigned to a string variable). The entire expression from &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;A$&lt;/b&gt;&lt;/span&gt; to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$&lt;/span&gt;&lt;/b&gt; should be highlighted.&lt;br /&gt;&lt;br /&gt;This will be accomplished by saving the first and last operand for each operator as the expression is processed. When an expression type error is detected, these operands will be available. When assigning the first operand to an operator, if the operand on done stack has a first operand assigned to it, then that operand will be used, otherwise the operand token on the done stack will be assigned. The same for the last operand.&lt;br /&gt;&lt;br /&gt;In the statement above, the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$&lt;/span&gt;&lt;/b&gt; operator will have &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;A$&lt;/b&gt;&lt;/span&gt; for its first operand (since &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A$&lt;/span&gt;&lt;/b&gt; does not have a first operand assigned to it) and &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;B$&lt;/b&gt;&lt;/span&gt; for its last operand (&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;B$&lt;/span&gt;&lt;/b&gt; does not have a last operand). At the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt;$&lt;/span&gt;&lt;/b&gt; operator, its first operand will be assigned to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A$&lt;/span&gt;&lt;/b&gt; (which is the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+$&lt;/span&gt;&lt;/b&gt; operand's first operand) and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$&lt;/span&gt;&lt;/b&gt; for its last operand (&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C$&lt;/b&gt;&lt;/span&gt; does not have a last operand).&lt;br /&gt;&lt;br /&gt;The first operand is no longer saved on the done stack except for string operands (a specific type operator has already been selected), the first operand needs to be attached to the token on the hold stack where the operator is residing until put into the output list. Therefore, the hold stack needs to hold structures containing a token pointer and a first operand token pointer instead of just a token pointer – a new hold stack item will be defined to hold these.&lt;br /&gt;&lt;br /&gt;The done stack currently holds output list element pointers (the output list consists of RPN items each containing a token pointer, number of operands and attached operand array, if any). The done stack will also need to hold the first and last operand token pointers. Therefore, the done stack needs to hold structures containing an output list element item pointer along with the first and last token pointers – a new done stack item will be defined to hold these.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-6363028996329124537?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/6363028996329124537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-first-and-last-operand.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6363028996329124537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6363028996329124537'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-first-and-last-operand.html' title='Translator – First and Last Operand'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8308821159166101870</id><published>2011-01-12T21:30:00.007-05:00</published><updated>2011-01-15T08:33:25.085-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Parser'/><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><title type='text'>Parser – Token Length</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;In researching for the last post, some issues were found in the Parser with respect to the token length. The token class contained a length member, but it was contained in the union along with the double value and integer values members used for constants. The thinking was that length would never be used with number constants; the length would be obtained from the string of the constant (which is being kept so that the constant could be reproduced exactly as entered).&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;The test routine contained code for determining the length of string constants. This required adding two for the surrounding double quotes (which are not stored) and adding one for each double quote contained in the constant (which is entered with two double quotes). It turned out that the length of the original string constant, including the surrounding double quotes was already being stored in the length member of the token. The code in the test routine was redundant and unnecessary (and was removed).&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Generally the length member was being used for the length of the token, but it wasn't being set for identifiers (variables, arrays, and user functions) and number constants where the length could be obtained from the string member.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;It will be easier if the length member always contained the length of the token so it will not required to obtain the length from the string member for certain token types. The length member was moved out of the union so it can also be used for number constants, and in the Parser, the length member was set for identifiers and number constants so now all token types are covered.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8308821159166101870?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8308821159166101870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/parser-token-length.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8308821159166101870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8308821159166101870'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/parser-token-length.html' title='Parser – Token Length'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2416815119383469192</id><published>2011-01-11T22:54:00.001-05:00</published><updated>2011-01-15T08:33:37.874-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Errors with a Range of Tokens</title><content type='html'>Currently when the Translator detects an error, the error code is returned along with the token where the error was detected. The caller uses the column and length values in the token to point to the token. (Later the token will be highlighted in a different color.)&lt;br /&gt;&lt;br /&gt;Now it is desired that a range of tokens be highlighted to show an entire sub-expression that contains an error. While it is possible to modify all the functions within the Translator for a second return token, there is an easier solution.&lt;br /&gt;&lt;br /&gt;The column and length members of the token are used to output the error – where the token starts and how long it is. The Translator, upon detecting an error with a range of tokens, only needs to modify the length token where the beginning of the error is detected, to include all the tokens. The Translator can do this by using the column of the first token, the column of the last token and the length of the last token. The equation would be:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;first-&amp;gt;length = last-&amp;gt;column – first-&amp;gt;column + last-&amp;gt;length&lt;/span&gt;&lt;/blockquote&gt;So when an error is detected and a range of tokens are involved, the length of the token being returned will be set using the equation above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2416815119383469192?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2416815119383469192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-errors-with-range-of-tokens.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2416815119383469192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2416815119383469192'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-errors-with-range-of-tokens.html' title='Translator – Errors with a Range of Tokens'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8027321073521950355</id><published>2011-01-10T21:20:00.001-05:00</published><updated>2011-01-15T08:33:56.258-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – First Operand (Updated Design)</title><content type='html'>Upon considering the first operand design (see posts starting on &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2010/07/translator-expression-type-new-design.html"&gt;July 8, 2010&lt;/a&gt;), There still be some confusion with the reported error message and the token at which it is pointing. Consider this simple statement (and the error produced currently):&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = A$ + B$ &amp;gt; C$&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^-- expected string expression&lt;/span&gt;&lt;/blockquote&gt;This does not make sense, because first, the &lt;i&gt;integer&lt;/i&gt; expression is valid. The error occurs because this integer expression cannot be assigned to a string variable. And it could be confusing because a &lt;i&gt;string&lt;/i&gt; expression cannot be placed where the greater than operator is. Alternatively it could indicate that a string operator is expected at the greater than (later why this was ruled out). The previously proposed &lt;b&gt;first operand&lt;/b&gt; design would produce this error:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = A$ + B$ &amp;gt; C$&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; ^^-- expected string expression&lt;/span&gt;&lt;/blockquote&gt;The error is now pointing to the beginning of the integer expression. But, one could say &lt;i&gt;wait a minute&lt;/i&gt;, &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;A$+B$&lt;/span&gt;&lt;/b&gt; &lt;i&gt;is&lt;/i&gt; a string expression, why is this an error? A better solution would produce this error:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$ = A$ + B$ &amp;gt; C$&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; ^^^^^^^^^^^^-- expected string expression&lt;/span&gt;&lt;/blockquote&gt;This is much better as it highlights the entire expression, an integer expression, and says that a string expression is expected here. This can be accomplished by, in addition to keeping track of the first operand (the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;A$&lt;/b&gt;&lt;/span&gt;), also keeping track of the last operand (the &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C$&lt;/span&gt;&lt;/b&gt;). The error would point to all tokens between the first and the last of the invalid expression. Now, how can these two tokens be passed back where currently only one token is being returned when an error occurs? Next, the solution to this...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8027321073521950355?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8027321073521950355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-first-operand-updated-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8027321073521950355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8027321073521950355'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-first-operand-updated-design.html' title='Translator – First Operand (Updated Design)'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4151340304443425131</id><published>2011-01-09T16:55:00.004-05:00</published><updated>2011-02-09T07:26:27.464-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pre-Release'/><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Expression Type Pre-Release</title><content type='html'>There are two main problems with the Twelfth (more error statements) test, namely the handling of the first operand of operators first mentioned on &lt;a href="http://interactivebasiccompilerproject.blogspot.com/2010/07/translator-expression-type-new-design.html"&gt;July 8, 2010&lt;/a&gt;,&amp;nbsp;and recognizing tokens with parentheses before assignment operators as arrays&amp;nbsp;only&amp;nbsp;(implying the operands are numeric subscripts).&lt;br /&gt;&lt;br /&gt;All of the other tests are succeeding, so it's probably a good idea to kick another pre-release first. This is the first release since development was switched to NetBeans, so there are some changes in the released files. NetBeans is not required for building the project. There is now full Makefile for building the program. NetBeans was used to initially generate this file, but it was modified to simplify it. The VIDE2 project file ibcp.vpj will no longer be part of the source files.&lt;br /&gt;&lt;br /&gt;Also no longer part of the source files is codes.txt and test_codes.h. Both of these files are now be generated by the new Makefile using the codes.awk and test_codes.awk awk scripts. The MinGW and MSYS packages both need to be installed in order to use the Makefile. The program build has only been tested with GCC 4.4.0 version for MinGW. Also, the awk program is needed for the awk scripts (I don't remember if this is part of MSYS or whether it needs to be installed separately).&lt;br /&gt;&lt;br /&gt;The Makefile is currently configured for building the release program with no symbols or debugging information. Debugging can be enabled by changing BASICOPTS from&amp;nbsp;"&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-O -s&lt;/span&gt;&lt;/b&gt;"&amp;nbsp;to&amp;nbsp;"&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-g&lt;/span&gt;&lt;/b&gt;"&amp;nbsp;in the Makefile. The file &lt;a href="http://sourceforge.net/projects/ibcp/files/Translator%20Dev.%20Releases/ibcp_0.1.14_Pre-Releases/ibcp_0.1.14-pre-3-src.zip/download"&gt;ibcp_0.1.14-pre-3-src.zip&lt;/a&gt; has been uploaded at &lt;a href="https://sourceforge.net/projects/ibcp/files/"&gt;Sourceforge IBCP Project&lt;/a&gt; along with the binary for the program. Now on to implementing the first operand design...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4151340304443425131?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4151340304443425131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-expression-type-pre-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4151340304443425131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4151340304443425131'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-expression-type-pre-release.html' title='Translator – Expression Type Pre-Release'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-6262007932478673075</id><published>2011-01-08T18:22:00.001-05:00</published><updated>2011-01-15T08:34:22.488-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – More Expression Type Debugging</title><content type='html'>The next problem was occurring when there was an unexpected operand when an operator, comma or closing parentheses was expected (for example: &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$=MID$(A$,B C&lt;/span&gt;&lt;/b&gt;). This was only occurring for functions with multiple arguments (ASC, MID$ and INSTR) when at the last argument of the shorter form. The “&lt;i&gt;expected operator or closing parentheses&lt;/i&gt;” error was produced, but a comma could follow for the optional argument.&lt;br /&gt;&lt;br /&gt;A checked was added to the parentheses status routine when at the last argument. If the function has the Multiple flag set, indicating there is another form with more arguments, then the “&lt;i&gt;expected operator, comma or closing parentheses&lt;/i&gt;” error is produced instead.&lt;br /&gt;&lt;br /&gt;One problem remained, the statement &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z$=MID$(A$,B,&lt;/span&gt;&lt;/b&gt; produced an “&lt;i&gt;expected string expression&lt;/i&gt;” at the end of the line where it should have been an “&lt;i&gt;expected numeric expression&lt;/i&gt;” error. The problem also occurred on the last optional argument of the INSTR and ASC functions. The problem was caused because the top of the count stack contained the index to the first form of these functions instead of to the second form with the optional argument.&lt;br /&gt;&lt;br /&gt;When the code went to get the argument's data type, it ran of the end off the operand data type array incorrectly picking up a string data type. The coding error was on the line that incremented the index of the token on the hold stack to the next form of the function and assigned it to the index on top of the count stack. A post-increment C operator was used instead of the pre-increment operator and the index on the count stack was not actually changed.&lt;br /&gt;&lt;br /&gt;Now all the test statements in the Eleventh Translator test are working (and on expected error needed to be corrected on the Third test because of the last fixed – it was missed previously). On to the Twelfth (more error statements) test...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-6262007932478673075?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/6262007932478673075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-more-expression-type_08.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6262007932478673075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/6262007932478673075'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-more-expression-type_08.html' title='Translator – More Expression Type Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-287469848853326475</id><published>2011-01-08T10:46:00.001-05:00</published><updated>2011-01-15T08:35:14.714-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – More Expression Type Debugging</title><content type='html'>Now that the data type was moved back from the expression information structure back to the main table entry structure, so that it is available for commands as well as operators and functions, and the code was working again the way it was, it was back to debugging the Eleventh (error tests) Translator test (after committing the working code to CVS) to continue fine tuning the error messages produced.&lt;br /&gt;&lt;br /&gt;The next problem to tackle was the generic “&lt;i&gt;expected expression&lt;/i&gt;” error being produced when a binary operator occurred in an expression when only a unary operator was expected. This error needed to be changed to the more specific “&lt;i&gt;expected &amp;lt;numeric/string&amp;gt; expression&lt;/i&gt;” errors. This was accomplish by calling the new get expression data type routine to get the current data type and producing the appropriate error.&lt;br /&gt;&lt;br /&gt;Next there were several error test statements that contained an unexpected comma in an expression, which were producing “&lt;i&gt;expected operator or end-of-statement&lt;/i&gt;” errors. This was the correct for some statements (for example: &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z=A+B,&lt;/span&gt;&lt;/b&gt; and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z=A,B=1&lt;/span&gt;&lt;/b&gt; and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z=A,&lt;/span&gt;&lt;/b&gt;), but, not for others (for example: &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z=,&lt;/span&gt;&lt;/b&gt; and &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z,Y=,&lt;/span&gt;&lt;/b&gt; and &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;Z$=,&lt;/b&gt;&lt;/span&gt;) where the correct error should have been “&lt;i&gt;expected &amp;lt;numeric/string&amp;gt; expression&lt;/i&gt;” errors.&lt;br /&gt;&lt;br /&gt;These errors are being handled in the comma token handler. These conditions can be determined by looking at the done stack. If the done stack is not empty, the expression up to the comma is valid, so expecting another operator or end-of-statement is appropriate. If the done stack is empty, then there is no valid expression yet for the assignment, so expecting an expression is appropriate. Again, to determine the type of expression, the new get expression data type routine is used.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-287469848853326475?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/287469848853326475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-more-expression-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/287469848853326475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/287469848853326475'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-more-expression-type.html' title='Translator – More Expression Type Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1032670279344529912</id><published>2011-01-06T21:39:00.003-05:00</published><updated>2011-01-15T08:35:32.891-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Command Expression Type</title><content type='html'>There was a problem getting the data type for the token on top of the command stack. There is no issue with assignment tokens as they contain a data type (they are just assignment operators put on the command stack).&lt;br /&gt;&lt;br /&gt;A while back, a new field was added to the Table entries for the expression type with possible values of None, Numeric, String and Any to be used with command entries. The idea at the time was that this would be used for the expression type checking (for the generation of the correct error messages). However, this field was not being used (the original expression type code added at the time was abandoned because it had too many problems – it is currently commented).&lt;br /&gt;&lt;br /&gt;This first attempt at the current problem was to use this expression type and convert it into a data type (None/Any to None, Numeric to Double, and String to String). The only place this was used was in the new get expression data type routine for commands. But this wasn't working for assignment commands (which were operators and their entries didn't have the expression type set – the data type in the expression information structure had the return value).&lt;br /&gt;&lt;br /&gt;So it was concluded that the expression type field should be removed and the data type moved back from the expression information structure into the main entry structure (where it was originally). When the Parser finds and creates a command token, it sets the data type of the token to data type from the table entry. Currently for all tokens, the Parser was getting the data type from the expression information structure or none if there was no structure (as is the case for commands).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1032670279344529912?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1032670279344529912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-command-expression-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1032670279344529912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1032670279344529912'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-command-expression-type.html' title='Translator – Command Expression Type'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2086559054856592128</id><published>2011-01-05T21:26:00.001-05:00</published><updated>2011-01-15T08:35:49.551-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Expression Type Implementation</title><content type='html'>A new routine was implemented to handle getting the current data type of the expression processed so far. This routine is called when the unexpected end of expression occurs to get the data type so that the correct “&lt;i&gt;expected ...&lt;/i&gt;” error can be reported, and is also called before pushing an opening parentheses token to the hold stack to set its data type (so that it can be carried through the rest of the expression).&lt;br /&gt;&lt;br /&gt;Once the routine was working, it was simplified. First, the token on top of the hold stack is checked for an operator before looking for the other conditions (parentheses, internal functions, and tokens with parentheses). This reduced the number of tests overall. An empty hold stack causes a bug error since at least the Null token should be on the stack.&lt;br /&gt;&lt;br /&gt;If the top hold stack token is the Null token, then the data type is obtained from the token on top of the command stack. This caused another problem with commands (more on this in the next post). If the top token is an opening parentheses, then its data type is used (which could be none). Otherwise the data type of the operator's operand is used (first operand for a unary operator, second operand for binary operator).&lt;br /&gt;&lt;br /&gt;If the top token on the hold stack is not an operator, then the top of the count stack is used to determine where to get the data type. If the count stack is empty, a bug error is returned since this situation should not happen. If the top is an internal function, then the data type of the current operand of the function is used. If the top is a parentheses, a bug error is returned since this situation should also not happen (parentheses token should have been on top of the hold stack). Otherwise the top contains a token with parentheses (an array or non-internal function) where the data type cannot be determined, so is set to None.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2086559054856592128?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2086559054856592128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-expression-type_05.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2086559054856592128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2086559054856592128'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-expression-type_05.html' title='Translator – Expression Type Implementation'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4292096226207156439</id><published>2011-01-01T19:15:00.001-05:00</published><updated>2011-01-15T08:36:24.536-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator - Expression Type With Parentheses</title><content type='html'>Determining the expression type to report the appropriate error within a parenthetical expression without another operator on the hold stack involves a little more work. To accomplish this, the expression type needs to carried from before the opening parentheses.&lt;br /&gt;&lt;br /&gt;To prevent having to scan backwards into the expression, when the opening parentheses is pushed on to the hold stack, the opening parentheses token will be assigned a data type, if possible, otherwise the data type will be left at the default data type of none (which will cause the generic “&lt;i&gt;expected expression&lt;/i&gt;” error if an error occurs).&lt;br /&gt;&lt;br /&gt;Here are several possibility of tokens that will be on the hold stack when an opening parentheses token is about to be pushed onto the hold stack and how to determine the data type to put into the parentheses token:&lt;br /&gt;&lt;blockquote&gt;Operator – get the expected operand data type of operator&lt;br /&gt;Internal function – get the expected argument operand data type of function&lt;br /&gt;Token with parentheses – can not determine data type&lt;br /&gt;Opening parentheses – inherit this token's data type&lt;br /&gt;Null – Look at data type for item on top of command stack&lt;/blockquote&gt;The first four possibilities are the same as before, so a common function will probably be implemented to handle determining the data type for the opening parentheses token. The last possibilities will require looking for the expected data type for the command on the command stack. Here are some examples of commands and expected data types for expressions:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;LET A = (&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp;      &lt;/span&gt;&lt;/span&gt;- assign token on command stack will have data type of variable&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PRINT (&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp;        &lt;/span&gt;&lt;/span&gt;- PRINT can take any type of expression, therefore none&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;INPUT PROMT (&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp;  &lt;/span&gt;&lt;/span&gt;- INPUT PROMPT expects string expression&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;IF (&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp;           &lt;/span&gt;&lt;/span&gt;- IF expects numerical expression&lt;/blockquote&gt;The IF statement has not been defined as of yet, but most likely will expect an integer expression (the result of all logical operators). However, a double expression will be accepted either with a different IF code expecting a double expression or the more likely, a hidden integer conversion code will be inserted. The IF will be defined later. Now on to the implementation of this...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4292096226207156439?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4292096226207156439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-expression-type-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4292096226207156439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4292096226207156439'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-expression-type-with.html' title='Translator - Expression Type With Parentheses'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-2075139962248072877</id><published>2011-01-01T11:17:00.001-05:00</published><updated>2011-01-15T08:36:50.876-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator - Expression Type Determination</title><content type='html'>In the Eleventh (error statements) tests, the are many statements for testing the correct error message in a line that contains something unexpected, like either an unexpected comma or end-of-line. One of these was just corrected (see last post) – the situation when the Translator is not in a parenthetical expression including inside array subscripts or function arguments. This was detected when the count stack is empty.&lt;br /&gt;&lt;br /&gt;The situation when in an internal function has also been handled when the operand processing was implemented. The code simply checks for the expected operand type for the current operand. An internal function is detected when the number of expected operands for the item on top of the count stack is non-zero. The current operand number is in the number of operands in top item on the count stack.&lt;br /&gt;&lt;br /&gt;For the remaining situation, the code was simply returning an “&lt;i&gt;expected expression&lt;/i&gt;” error, since it was assumed that the type of expression could not be determined. Turns out, this is not entirely true. Two sub-conditions to this situation are inside a parentheses and inside an array or non-internal function (a token with a parentheses). Each of these can be further sub-divided into whether this is an operator or not. Here are examples of each of these four conditions (terminated with an unexpected end-of-line):&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z = (&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp;    &lt;/span&gt;&lt;/span&gt;in parentheses, no operator&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z = (A+&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp;  &lt;/span&gt;&lt;/span&gt;in Parentheses, with operator&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z = A(&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp;   &lt;/span&gt;&lt;/span&gt;in token with parentheses, no operator&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Z = A(B+&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;in token with parentheses, with operator&lt;/blockquote&gt;In the third case, the expected expression type can't be determined because the Translator does not know if A is an array (expression must be numeric for a subscript) or a function (expression can be any type), therefore the “&lt;i&gt;expected expression&lt;/i&gt;” error is appropriate. In the other cases, the expression type can be determined and in these examples, this&amp;nbsp;would&amp;nbsp;mean an “&lt;i&gt;expected numeric expression&lt;/i&gt;” error.&lt;br /&gt;&lt;br /&gt;For the two cases with an operator, the data type of the operand or the operator on top of the hold stack can be used to determine the expected type of expression to follow (just like for a non-parenthetical expression just corrected). For the first case, with just a parentheses, determining the expression type is a little more involved...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-2075139962248072877?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/2075139962248072877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-expression-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2075139962248072877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/2075139962248072877'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2011/01/translator-expression-type.html' title='Translator - Expression Type Determination'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-3617130997560721498</id><published>2010-12-30T21:22:00.000-05:00</published><updated>2011-01-15T08:40:42.538-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – More Operand Processing Debugging</title><content type='html'>Continuing with debugging, the next difference was a PRINT command that contained sub-string functions where the expected results needed to be updated (sub-string functions don't get attached tokens, tokens are attached to next token).&lt;br /&gt;&lt;br /&gt;Finally in the Tenth (PRINT statements) test, there were three “&lt;i&gt;debug #1&lt;/i&gt;” bug errors, which should have been an “&lt;i&gt;expected numeric expression&lt;/i&gt;” errors. These test lines were incomplete statements (e.g. &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PRINT A+&lt;/span&gt;&lt;/b&gt;). This bug error was put in to fix later because the existing code was not correct. The code was modified to return the expected type error for the operand of the operand token on top of the hold stack (taking into account whether it is the first operand of a unary operator or second operand for a binary operator). It was previously set to return the variable type for the command on top of the command stack (which was wrong – the PRINT command has no data type).&lt;br /&gt;&lt;br /&gt;Now on the the Eleventh (error statements) tests, which has quite of few incorrect error messages...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-3617130997560721498?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/3617130997560721498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-more-operand-processing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3617130997560721498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/3617130997560721498'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-more-operand-processing.html' title='Translator – More Operand Processing Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-4185931988192549877</id><published>2010-12-29T23:26:00.002-05:00</published><updated>2010-12-29T23:26:00.127-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NetBeans'/><title type='text'>Windows, NetBeans and CVS (CVSNT)</title><content type='html'>This post is not strictly related to the IBCP project, but will be helpful explaining how NetBeans (6.9.1) on Windows (XP) was made to work with CVS since it took nearly a day or searching and experimenting to accomplish (and many others were having similar problems).&lt;br /&gt;&lt;br /&gt;The initial hope was that NetBeans for Windows would play nice with the CVS installed with MSYS (Minimum SYStem), but it did not. Searching indicated that NetBeans requires a CVS server even for a local repository and apparently, the CVS that comes with MSYS is not sufficient, though when doing a &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cvs&amp;nbsp;‑v&lt;/span&gt;&lt;/b&gt; command, it does respond &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;… 1.11&amp;nbsp;(client/server)&lt;/span&gt;&lt;/b&gt;. Further searching uncovered The CvsGui project and the WinCVS 2.1.1.1 package (includes WinCVS and CVSNT) was downloaded from &lt;a href="http://sourceforge.net/projects/cvsgui/files/"&gt;http://sourceforge.net/projects/cvsgui/files/&lt;/a&gt;. Initially only the CVSNT package was installed (and this may have been sufficient).&lt;br /&gt;&lt;br /&gt;Not realizing that there was a Service control panel under the Start menu (under CVSNT) that is used to configure CVSNT, the WinCVS package was installed. Normally WinCVS will also install the required CVSNT (the CVS server), but can be skipped if CVSNT is already installed. WinCVS is a very nice GUI for looking at checked out software (including nice version and branch graphs), however, it does not contain any configuration of CVSNT. And exactly how to check out a module from the repository was not discovered. This was not important as either the command line or NetBeans can be used to check out a module.&lt;br /&gt;&lt;br /&gt;Once CVSNT is installed (indicates version 2.0.51d), it requests that Windows be restarted. This is necessary to install and start the CVS services, which occurred automatically upon reboot. Next the CVS server needs to be configured by using the Service control panel. The first tab reported that the services (CVS Service and CVS Lock service) were both running (a good sign).&lt;br /&gt;&lt;br /&gt;The CVS repository needs to be identified using the Repositories tab by selecting Add. Using the browse button on the next dialog (the ... button), the repository that had been previously placed at &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C:/msys/1.0/home/cvsroot&lt;/span&gt;&lt;/b&gt; by using the MSYS CVS command was selected and entered in the Location field. The Name field was set to &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;/msys/1.0/home/cvsroot&lt;/b&gt;&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;After selecting &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Checkout...&lt;/span&gt; in NetBeans, the &lt;i&gt;CVS Root&lt;/i&gt; was set to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;:local:/msys/1.0/home/cvsroot&lt;/span&gt;&lt;/b&gt; using the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;Edit...&lt;/b&gt;&lt;/span&gt; button, setting the Access Method to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;local&lt;/span&gt;&lt;/b&gt; and setting the Repository path to &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;/msys/1.0/home/cvsroot&lt;/b&gt;&lt;/span&gt; (the same name as entered in the Name field in the CVSNT Service control panel Repositories tab). If all goes well, selecting &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Next&amp;gt;&lt;/span&gt;&lt;/b&gt; will immediately advance to the &lt;i&gt;Module to Checkout&lt;/i&gt; page where the Module, Branch and Location Folder fields can be set. If this doesn't appear immediately, NetBeans either responds with an error, or spins its wheels looking for something (don't bother waiting – it's not going to work).&lt;br /&gt;&lt;br /&gt;Several environment variables were set in the attempt to get it work and may or may not be necessary. The environment variables can be accessed by right-clicking on My&amp;nbsp;Computer and selecting Properties, then going to the Advanced tab and selecting Environment Variables. Under System variables the following was entered:&lt;br /&gt;&lt;blockquote&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;PATH&lt;/span&gt;&lt;/b&gt; – Edited with &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C:\Program Files\cvsnt;&lt;/span&gt;&lt;/b&gt; at the beginning&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CVSROOT&lt;/span&gt;&lt;/b&gt; – New set to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C:\msys\1.0\home\cvsroot&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CVS_EXE&lt;/span&gt;&lt;/b&gt; – New set to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C:\Program Files\cvsnt\cvs.exe&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CVS_RSH&lt;/span&gt;&lt;/b&gt; – New set to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C:\Program Files\cvsnt\cvs.exe&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;One last warning about using CVSNT on Windows. CVSNT expects text files in the repository to be in DOS format (lines are terminated by CR/LF characters). If the text files are in Unix format (terminated by only LF characters), upon checkout, CVSNT will mess up the files by putting extra CR characters on each line. This is probably due to being a Windows program and expecting that text files to be in the expected Windows (DOS) format.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-4185931988192549877?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/4185931988192549877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/windows-netbeans-and-cvs-cvsnt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4185931988192549877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/4185931988192549877'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/windows-netbeans-and-cvs-cvsnt.html' title='Windows, NetBeans and CVS (CVSNT)'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-9138808402004182020</id><published>2010-12-29T17:51:00.003-05:00</published><updated>2010-12-29T17:51:00.073-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><category scheme='http://www.blogger.com/atom/ns#' term='NetBeans'/><title type='text'>NetBeans and Debugging – Conclusions</title><content type='html'>Enough time has now been spent debugging with NetBeans to make some conclusions. After some adjusting, using the GDB debugger under NetBeans appears to be easier then using Insight, the &amp;nbsp;GUI front-end to GDB. The two are definitely different and initially it appeared that is was more difficult looking inside classes with NetBeans, but this was not the case. NetBeans puts the active local variables for each code line executed in the Variables window automatically and it's very easy to step into them to look at the contents.&lt;br /&gt;&lt;br /&gt;With Insight, the variables first need to be added to the Watch window. Insight is never aware of allocated arrays for pointer members – it treats them as simply pointers. If you want to look at the contents of a particular array element, another variable needs to be added to the Watch window. And if too many variables are added to the Watch window, Insight becomes unstable (crashes). NetBeans usually appears to be aware of arrays and lets you descend into which ever element you want to look at.&lt;br /&gt;&lt;br /&gt;In Insight there is no way to edit a Watch variable name, say to look at a different array element – it must be deleted and a new one entered (a lot of typing). In NetBeans, the watch variables can be edited (using Customize). Though disconcerting, with the jVi plugin installed, NetBeans requires the use of Vi commands in the New Watch and it starts in command mode – this will take a little getting used to. One last thing about the jVi plugin – sometimes it just stops working (NetBeans returns to its default editor). Restarting NetBeans corrects the problem.&lt;br /&gt;&lt;br /&gt;In conclusion, NetBeans nicely integrates everything, therefore, development will be transferred to the NetBeans IDE with CVSNT (see next post on how this was made to work). The next release of the source will include the necessary files to build with NetBeans (development with VIDE2 will now be abandoned).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-9138808402004182020?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/9138808402004182020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/netbeans-and-debugging-conclusions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/9138808402004182020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/9138808402004182020'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/netbeans-and-debugging-conclusions.html' title='NetBeans and Debugging – Conclusions'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5486076272333261630</id><published>2010-12-29T14:27:00.002-05:00</published><updated>2011-01-15T08:40:42.539-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Expression Type'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><title type='text'>Translator – Operand Processing Debugging</title><content type='html'>The Ninth (LET command) test contained multiple equal assignments, so the expected results needed to be updated since the multiple equal assignments feature was removed. Once the expected results were corrected, including removing the comma sub-code that was only needed to tell the difference between multiple equal and comma assignments, this test was successful. There was no necessity to used debugging here, but on to the Tenth (PRINT command) test that is crashing...&lt;br /&gt;&lt;br /&gt;The Tenth test was crashing because of an invalid status code was being returned. This was tracked down to the add print code routine that was calling the process final_operand routine incorrectly (passed status variable as an argument instead of setting it to the return value).&lt;br /&gt;&lt;br /&gt;Now all the PRINT commands were generating a “done stack not empty” bug error. This was caused by the hidden print codes (PrintDbl, PrintInt and PrintStr) not being popped from the done stack. These should not have been pushed on to the done stack and this was caused because these codes did not have the Print flag set in the table, which would have prevented them from being pushed on to the done stack.&lt;br /&gt;&lt;br /&gt;Next the PRINT commands were generating a “invalid use of print function” error at the PRINT command. This was caused during the processing of the last hidden print code on the statement when the top of the command stack was checked for the PRINT command (the stack was empty, so the check was not performed). The PRINT command had been popped by the End-of-line command handler that called the PRINT command handler, which handles the last print code by calling the add print code routine. The add print code calls the process final operand routine, which checked for the print command. The solution was for the End-of-line command handle to leave the command on top of the stack when the command's handler is called and then pop the command off upon returning.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5486076272333261630?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5486076272333261630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-operand-processing-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5486076272333261630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5486076272333261630'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-operand-processing-debugging.html' title='Translator – Operand Processing Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8103814887768376620</id><published>2010-12-28T22:29:00.000-05:00</published><updated>2010-12-28T22:29:26.661-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><category scheme='http://www.blogger.com/atom/ns#' term='NetBeans'/><title type='text'>NetBeans and Debugging</title><content type='html'>Now with the CVS/CR problem resolved (the NetBeans editor will show modifications from the CVS repository as changes are made) and the program builds and runs, it was time to start the debugger.&lt;br /&gt;&lt;br /&gt;First off, NetBeans gave a warning that GDB 6.3 (installed with MinGW) was not supported. A later version (7.2) was found at the MingGW Sourceforge page &amp;nbsp;&lt;a href="http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/GDB/GDB%E2%80%917.2/"&gt;http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/GDB/GDB‑7.2/&lt;/a&gt; and the gdb‑7.2‑1‑mingw32‑bin.tar.lzma file was downloaded. This file consisted of three files, gdb.exe, gdbserver.exe and gdb‑python27.exe. The current files at \MinGw\bin were renamed to gdb‑6.3.exe and gdbserver-6.3.exe just in case they were needed and the three new files were copied in. Insight appears to still run, but I'm not sure if it using GDB 6.3 or GDB 7.2. NetBeans now seemed to be happy.&lt;br /&gt;&lt;br /&gt;The next thing to figure out was how to specify command line arguments for the program being debugged. With Insight, this was done with the Console window using the “&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;set&amp;nbsp;args&lt;/span&gt;” command. The first thing attempted was to enable the GDB console in NetBeans, but there is not need to explain how to do that because the console isn't available until the program is started and by then it is too late for the program to see the arguments set because it had already read them. The solution was discovered under Project Properties in the Run section – there is an Arguments setting. &amp;nbsp;Now with the arguments set to “&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;‑t&amp;nbsp;9&lt;/span&gt;” for Ninth Translator test, debugging can begin...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8103814887768376620?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8103814887768376620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/netbeans-and-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8103814887768376620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8103814887768376620'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/netbeans-and-debugging.html' title='NetBeans and Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-7994536065652669192</id><published>2010-12-28T16:26:00.000-05:00</published><updated>2010-12-28T16:26:35.970-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><category scheme='http://www.blogger.com/atom/ns#' term='NetBeans'/><title type='text'>NetBeans – Building the Program</title><content type='html'>Before debugging, the program needed to be built. Within NetBeans, the IBCP project was created and the IBCP source code was checked out of the CVS repository. The .h include files were added in the project under Header files and the .cpp source files were added under Source files. If NetBeans proves satisfactory, the necessary NetBeans files will be included with the source files.&lt;br /&gt;&lt;br /&gt;First, some options were set in NetBeans to simply the default directory structure, which assumes a multiple platform product - only Windows is being used here. By default, programs built are put into the directory “dist\Debug\MinGW-Windows” (for the debug configuration, “Release” for the release configuration). This is unnecessary and inconvenient. &amp;nbsp;To make it build ibcp.exe in the root IBCP directory, the option in Project Properties, Linker, Output was changed to just ibcp from the more involved default ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/ibcp.&lt;br /&gt;&lt;br /&gt;Selecting build project immediately generated errors. The first file was opened and it looked as if it was double spaced (back-slash terminated line continuations caused the errors since the blank line prematurely terminated the line). Somehow in most of the source files, a control-M got added to the end of each line. This is a Unix vs. DOS test file format issue – Unix puts a single newline (control-J or linefeed) at the end of each line and DOS (Windows) puts a CRLF (control-M/control-J) at the end of each line. Vim deals with this invisibly and the GCC compilers ignore it.&lt;br /&gt;&lt;br /&gt;I first noticed a week ago that these CRLF were in some of the source files when I did a “cvs diff” command it showed the whole file had changed. Outputting the diff into a file and looking at it with Vim showed the problem was all the lines from one file had “^M” characters at the end of each line, therefore causing no lines to compare. This was causing no problems with either Vim or the compiler.&lt;br /&gt;&lt;br /&gt;After some playing around, the problem was discovered to be caused by CVSNT needed by NetBeans (more on this later), which seems to get confused by Unix format files in the repository. The first attempt was to convert all the files to Unix format, but this did not help. After all the files were converted to DOS format, the problem appeared to be solved. Further checkouts were OK. The program then built with no issues. Tests ran as last released. Now on to debugging...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-7994536065652669192?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/7994536065652669192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/netbeans-building-program.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7994536065652669192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/7994536065652669192'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/netbeans-building-program.html' title='NetBeans – Building the Program'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-911713717497911900</id><published>2010-12-28T09:50:00.001-05:00</published><updated>2010-12-28T16:26:54.352-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><category scheme='http://www.blogger.com/atom/ns#' term='NetBeans'/><title type='text'>NetBeans and Vim (jVi plugin)</title><content type='html'>The version of NetBeans installed is the latest 6.9.1 and can be obtained for free at &lt;a href="http://netbeans.org/"&gt;http://netbeans.org/&lt;/a&gt;. &amp;nbsp;The C/C++ pack was installed. &amp;nbsp;JDK 6 (Java Development Kit) also needs to be installed, but that was already installed on the computer for something else. &amp;nbsp;The jVi (vi editor clone) plugin can be downloaded at &lt;a href="http://sourceforge.net/projects/jvi/"&gt;http://sourceforge.net/projects/jvi/&lt;/a&gt;. &amp;nbsp;The downloaded nbvi‑1.3.0.x1.zip file was unzipped, which contains a directory that was put into the Program Files\NetBeans 6.9.1 directory. To install this plugin package, once NetBeans was installed and running, go to Tools/Plugins and the Downloaded tab. Select “Add Plugins...” and find the nbvi-1.3.0.x1 directory and select the two .nbm files. Once both are selected, select the Install button.&lt;br /&gt;&lt;br /&gt;Before going into what was needed to make CVS work with NetBeans (which is not necessary for building the IBCP program from the source, but I want to give details on how to do it since it may help someone else in a similar situation as it took a bit of searching to figure it out), I wanted to see what was needed to make debugging work within NetBeans (it works very nice under Linux). This can be done by actually debugging&amp;nbsp;starting with&amp;nbsp;the Ninth Translator (Commands) test...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-911713717497911900?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/911713717497911900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/netbeans-and-vim-jvi-plugin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/911713717497911900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/911713717497911900'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/netbeans-and-vim-jvi-plugin.html' title='NetBeans and Vim (jVi plugin)'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-5226272202350139839</id><published>2010-12-27T23:47:00.003-05:00</published><updated>2010-12-28T16:27:10.852-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project'/><category scheme='http://www.blogger.com/atom/ns#' term='NetBeans'/><title type='text'>New Development Environment</title><content type='html'>I decided to try out a new IDE I recently learned about – NetBeans, which has integration with CVS, an integrated debugger (front end to GDB), and there is an available plugin to get vim editor capability. Getting the Windows version to work properly was going to be a challenge through.&lt;br /&gt;&lt;br /&gt;Currently for development, MSYS (Minimum SYStem) with MinGW (Minimum GNU for Windows) is being used with CVS for MSYS installed for version control. &amp;nbsp;MinGW was updated to version 4.4.0 of the GNU Compiler Suite. For controlling (building) the project, VIDE2 (a simple IDE) is being used, but it contains a very primitive editor (gVim is being used instead for editing). For debugging, Insight, a GUI front end for GDB (version 6.3) is installed. Insight is not exactly stable (crashes a lot), and the latest version 6.8.1 could not be made to work with MSYS.&lt;br /&gt;&lt;br /&gt;I'm not sure I will be able to get NetBeans working satisfactory. So far, after a lot of struggle, NetBeans is working with CVS, though not the CVS that was installed with MSYS. Complete details will be in a future post. The IBCP was successful checked out of the CVS repository with NetBeans, the IBCP project was created NetBeans and was built successfully. Next will be to get the debugger working.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-5226272202350139839?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/5226272202350139839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/new-development-environment.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5226272202350139839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/5226272202350139839'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/new-development-environment.html' title='New Development Environment'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1674060154434435896</id><published>2010-12-27T10:09:00.003-05:00</published><updated>2011-02-09T07:26:02.832-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pre-Release'/><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><category scheme='http://www.blogger.com/atom/ns#' term='Strings'/><title type='text'>Translator – Sub-String Pre-Release</title><content type='html'>Now the first eight Translator tests succeed. There are more problems to correct with tests 9 through 12 (test 10 crashes). But, since it has been half a year since code has been released, it's time to commit and tag the changes to CVS and make another pre-release.&lt;br /&gt;&lt;br /&gt;I was distracted during the last two months with a work project and didn't get much time to work on this project. I made the mistake of not committing the last good working code to CVS (mainly because I wanted to fix just one more bug). &amp;nbsp;It took almost a week to recover, figure out what I was in the middle of, make the code compile again, and get the most recent changes working (almost). With that accomplished, a pre-release can be made. The file &lt;a href="http://sourceforge.net/projects/ibcp/files/Translator%20Dev.%20Releases/ibcp_0.1.14_Pre-Releases/ibcp_0.1.14-pre-2-src.zip/download"&gt;ibcp_0.1.14-pre-2-src.zip&lt;/a&gt; has been uploaded at &lt;a href="https://sourceforge.net/projects/ibcp/files/"&gt;Sourceforge IBCP Project&lt;/a&gt; along with the binary for the program. Now on to more debugging to get the rest of the tests working again...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1674060154434435896?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1674060154434435896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-sub-string-pre-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1674060154434435896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1674060154434435896'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-sub-string-pre-release.html' title='Translator – Sub-String Pre-Release'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-8071905066790292301</id><published>2010-12-25T23:10:00.000-05:00</published><updated>2010-12-25T23:10:07.298-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><category scheme='http://www.blogger.com/atom/ns#' term='Strings'/><title type='text'>Translator – Sub-String Debugging</title><content type='html'>To implement the sub-string change, not pushing the sub-string function to the done stack leaving its string operand on the stack (to carry to the next token), is accomplished by using the same mechanism that prevents print function from being pushed on the done stack (set the done push flag to false). With the number of operands being left set to zero, the sub-string function's string operand will be left on the done stack.&lt;br /&gt;&lt;br /&gt;As debugging continued, nothing was getting attached to some AssignStr tokens. The assign command handler was only attaching tokens of the String data type, not the TmpStr data type returned (by the concatenate operator and the non-sub-string functions). In these cases, the AssignStr code will be changed to the AssignStrTmp code, but none of the associated codes for TmpStr arguments have been implemented yet (that will come next). Therefore, this will be left as is for now (TmpStr tokens will not be attached to AssignStr).&lt;br /&gt;&lt;br /&gt;The new sub-string implementation (not pushing them on the done stack), made sub-string assignments stop working (produced “&lt;i&gt;done stack empty&lt;/i&gt;” errors). The variable being assigned was popped from the done stack because it was not needed since it doesn't need to be attached to a token. When the assignment operator (equal) went to look for what was being assigned to determine which assignment code was needed, the done stack was empty. In this case, the sub-string function needs to be on the done stack. Therefore, a check was added to still push the sub-string function token if its reference flag is set.&lt;br /&gt;&lt;br /&gt;The sub-string change also affected error reporting - the “&lt;i&gt;expected numeric expression&lt;/i&gt;” error for a statement like &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;Z=B+MID$(A$,2,3)&lt;/b&gt;&lt;/span&gt; was now incorrectly pointing to the A$ instead of the MID$ token (because the A$ carried forward and the MID$ token was not on top of the done stack).&lt;br /&gt;&lt;br /&gt;To correct this problem, the code at the end of the find code routine that returns the appropriate error when an operand of the wrong data type was modified. If the last token appended to the output list doesn't match the top token on the done stack and the last token is a sub-string function, then the token returned is set to the sub-string token instead of the top token.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-8071905066790292301?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/8071905066790292301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-sub-string-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8071905066790292301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/8071905066790292301'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-sub-string-debugging.html' title='Translator – Sub-String Debugging'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7660361599834253025.post-1979095870664309861</id><published>2010-12-24T20:30:00.002-05:00</published><updated>2010-12-24T20:30:47.893-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Translator'/><category scheme='http://www.blogger.com/atom/ns#' term='Strings'/><title type='text'>Translator – Sub-String Implementation</title><content type='html'>Implementation of the transfer of operands of sub-strings will mostly take place in the process final operand function. But first, some information needs to be added to the Table, namely the number of string arguments each code has. This value could be calculated on the fly as needed, but it will make for a simpler design to just put these values in the table. The table initialization code (Table constructor) was modified to calculate these values automatically.&lt;br /&gt;&lt;br /&gt;In the process final operand routine, the internal function and operator section, when the number of operands passed in is zero, needs to set the number of operands to the number of string arguments that are on the done stack. These operands will be popped from the done stack and attached to the internal function or operand token. &amp;nbsp;Only string operands were left on the done stack (other numeric operands were popped by the find code routine as they do not need to be attached to any token).&lt;br /&gt;&lt;br /&gt;However, for sub-string functions, which have only one string operand, the string operand will be left on the done stack, to be attached to the next token. If the next token is another sub-string function, then the string operand argument will continue to be carried forward. Therefore, the number of (string) operands to pop from the done stack will only be set to the code's number of string arguments if the code is not a sub-string. For sub-string function, the number of operands will be left set to zero, so nothing will be popped and attached to the sub-string function token.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7660361599834253025-1979095870664309861?l=interactivebasiccompilerproject.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interactivebasiccompilerproject.blogspot.com/feeds/1979095870664309861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-sub-string-implementation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1979095870664309861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7660361599834253025/posts/default/1979095870664309861'/><link rel='alternate' type='text/html' href='http://interactivebasiccompilerproject.blogspot.com/2010/12/translator-sub-string-implementation.html' title='Translator – Sub-String Implementation'/><author><name>Thunder422</name><uri>http://www.blogger.com/profile/03289782319864838007</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
