Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoder: added position index assignment step
renamed assignCodes() to prepareTokens() since it was more efficient to assign the position indexes in the same loop as for assigning codes instead of a new function with the same loop and switch statements; changed to return size of program line instead of boolean status added index member to token to hold the program code position index; added associated access functions modified RPN list, item and token text functions to optionally add the program word index to the text output; for token text output, made sure second word was separate from first word (which may have sub-codes), and also made REM string the operand word when outputting indexes updated expected results for encoder test #1 for new index values and added another multiple statement test statement
- Loading branch information
1 parent
88913ed
commit 9e0e442
Showing
9 changed files
with
88 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ B%=6 | |
PRINT B% | ||
C$="Test" | ||
PRINT C$ | ||
|
||
INPUT PROMPT "Enter:";D%:LET E=SQR(D%):PRINT D%,E' comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
|
||
Input: A=5 | ||
Output: VarRef |A| Const |5| Assign | ||
Output: 0:VarRef 1:|A| 2:Const 3:|5| 4:Assign | ||
|
||
Input: PRINT A | ||
Output: Var |A| PrintDbl PRINT | ||
Output: 0:Var 1:|A| 2:PrintDbl 3:PRINT | ||
|
||
Input: B%=6 | ||
Output: VarRefInt |B%| ConstInt |6| Assign% | ||
Output: 0:VarRefInt 1:|B%| 2:ConstInt 3:|6| 4:Assign% | ||
|
||
Input: PRINT B% | ||
Output: VarInt |B%| PrintInt PRINT | ||
Output: 0:VarInt 1:|B%| 2:PrintInt 3:PRINT | ||
|
||
Input: C$="Test" | ||
Output: VarRefStr |C$| ConstStr |Test| Assign$ | ||
Output: 0:VarRefStr 1:|C$| 2:ConstStr 3:|Test| 4:Assign$ | ||
|
||
Input: PRINT C$ | ||
Output: VarStr |C$| PrintStr PRINT | ||
Output: 0:VarStr 1:|C$| 2:PrintStr 3:PRINT | ||
|
||
Input: INPUT PROMPT "Enter:";D%:LET E=SQR(D%):PRINT D%,E' comment | ||
Output: 0:ConstStr 1:|Enter:| 2:InputParseInt 3:InputBeginStr 4:VarRefInt 5:|D%| 6:InputAssignInt 7:INPUT-PROMPT':' 8:VarRef 9:|E| 10:VarInt 11:|D%| 12:CvtDbl 13:SQR( 14:Assign'LET:' 15:VarInt 16:|D%| 17:PrintInt 18:, 19:Var 20:|E| 21:PrintDbl 22:PRINT 23:' 24:| comment| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters