Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
BASIC09
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Compiler=== The internal multipass compiler converts BASIC09 [[source code]] into a [[Lexical analysis|token]]ized, optimized, [[bytecode]], called I-code.{{sfn|Manual|1984|p=11.1}} I-code differs from the more traditional tokenizing approach found in most BASICs in that a number of items were placed directly in memory instead of using references that then had to be looked up.{{sfn|Manual|1984|p=11.2}} For instance, in MS-based interpreters, a variable reference in code is left in string format; the variable <code>VAR</code> would be represented in memory by the three [[ASCII]] characters "VAR". During execution, when this variable is encountered in the code the interpreter has to look up that string in a table of variables, find the associated storage address in memory, and then finally read the value stored in that location. The table is usually constructed so that the value follows the name, to save time during the final lookup.{{sfn|Manual|1984|p=11.1}} In contrast, in I-code the address of the variable is determined in advance and the reference in code is replaced by that address. This avoids a runtime search through the variable table.{{sfn|Manual|1984|p=11.1}} Other optimizations include a separate <code>FOR/NEXT</code> routine used when the index variable is an INTEGER, and separate INTEGER and REAL math libraries.{{sfn|Manual|1984|p=11.2}}{{efn|Atari BASIC also worked in this way, the source code was compiled to tokens when the line was entered and any variable references replaced by a pointer to storage.}} For added performance, BASIC09 also included the <code>PACK</code> command which took a procedure name and returned an optimized version. Some of these optimizations included removing non-coding instructions like code comments and the replacement of constant expressions to a single value. For instance, <code>PACK</code> would recognize that <code>LET x=x+SQR(100)/2</code> contains only constants on the right, and replaces it with the code <code>x=x+5</code>, which requires only a single operation at runtime, the addition, removing the division and square root. <code>PACK</code> reduced the memory footprint of the procedure and improved performance by about 10 to 30%.{{sfn|Manual|1984|p=11.3}}
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
BASIC09
(section)
Add topic