8529b976e3
Add BasicVariable to replace BasicValue as the primary vehicle for managing variables in BASIC
Andrew Kesterson2025-06-02 22:32:41 -04:00
e4c5774ca9
WIP. DIM currently does nothing. Variables are still replacing Values. Assignments and references with subscripts look like they work but don't subscript anything.
Andrew Kesterson2025-05-26 19:40:40 -04:00
f461aafced
WIP : Adding DIM statement, refactoring away from using BasicValue for everything, and adding BasicVariable which has a set of BasicValue objects depending on the dimensions of the variable. Will be a significant refactor.
Andrew Kesterson2025-02-15 12:49:36 -05:00
f26e0a67b2
Builtin functions have not been working since user-defined functions were introduced, this fixes it
Andrew Kesterson2025-05-26 21:15:13 -04:00
8e38b0c2f9
Made it possible to nest control structures. Showed example in the FOR/NEXT commands. Added a test harness.
Andrew Kesterson2025-01-29 22:57:21 -05:00
ecebe2a14c
Fixed methods with multiple arguments, made the DEF parser inject functions into the runtime, not the runtime method, so the parser can properly process function calls in the REPL after the def before RUN is issued
Andrew Kesterson2025-01-23 19:57:25 -05:00
31765fd9c8
Broke builtin functions out to basicruntime_functions.go
Andrew Kesterson2025-01-23 12:41:24 -05:00
528bf150e6
User defined functions are working as expected at this time.
Andrew Kesterson2025-01-23 10:55:26 -05:00
63ce2b2a0b
Implemented argument lists for functions (and commands). Implemented LEN and MID functions. Added functions to expression parsing before primaries so they can be included in calculations.
Andrew Kesterson2025-01-22 18:28:07 -05:00
487b1778d2
Made it possible to have multiple nested environments (this will allow us to nest loops / branches later)
Andrew Kesterson2025-01-22 15:32:49 -05:00
2c045265ec
Multiple statements per line (separated by : ) are working. Removed :ELSE from IF syntax until ELSE can be made its own command.
Andrew Kesterson2025-01-22 14:20:48 -05:00
e2df01b257
FOR automatic step generation is working in both positive and negative directions, but with STEP values <> 1, the loop will step past the end of the intended range
Andrew Kesterson2025-01-20 17:57:21 -05:00
4c956b0b37
Got all operators of the same precedence looping correctly
Andrew Kesterson2025-01-18 16:02:23 -05:00
9ce99d8da9
Setting and evaluating variables seems to work. Like this:
Andrew Kesterson2025-01-18 10:53:07 -05:00
7b0e83fb18
Implemented reflection to look up command methods on the runtime struct during evaluation instead of maintaining a map of strings to functions
Andrew Kesterson2025-01-17 13:35:09 -05:00
78d8937af2
Fixed binary operators to return a new value instead of modifying the lval in place
Andrew Kesterson2025-01-17 11:00:53 -05:00
7b7a434701
Immediate mode commands are executing inside the REPL now (RUN, QUIT)
Andrew Kesterson2025-01-17 08:36:47 -05:00
9660db6026
Using RUN from inside of a previously sourced set of lines works, but RUN from the repl doesnt because the REPL isn't interpretet()ing right now...
Andrew Kesterson2025-01-17 02:09:21 -05:00
7839ea1fce
Reorganized code, added 3 different run modes to support a 'RUN' command. REPL and RUNSTREAM modes work correctly, RUN does not.
Andrew Kesterson2025-01-15 00:40:36 -05:00
c4bc168f4f
I don't think string comparisons ( < and > ) are working correctly
Andrew Kesterson2025-01-14 17:03:53 -05:00
4c381c93cc
It works! Single line immediate mode REPL is working and parsing complete lines with complex nested expressions.
Andrew Kesterson2025-01-14 16:52:22 -05:00
5fa617ea9c
Commands and functions are typed appropriately by the scanner
Andrew Kesterson2025-01-14 09:53:57 -05:00
20d9c42884
Reserved word identifiers (GOSUB, etc) recognized as distinct from variable names
Andrew Kesterson2025-01-14 09:17:06 -05:00
adcb61388a
Got variable identifiers parsing with primary values
Andrew Kesterson2025-01-14 09:03:08 -05:00
46c7959458
Logical operators (AND, OR, NOT), and Unary (MINUS) aren't working properly. AND/OR only parse an integer literal, NOT/MINUS cause segfault.
Andrew Kesterson2025-01-14 08:20:18 -05:00
0164db74f0
Parser is starting to work. <> gets scanned as two lexemes. Unary types are being toString()ed with only their literal, not their operator. Probably more bugs.
Andrew Kesterson2025-01-14 00:03:29 -05:00
441246c753
Make a parser interface, break the lox and basic parsers apart, put down the rest of the lox parser. Need to change the way newLeaf and the BasicASTLeaf.new* methods are being used, the parser_interface should implement some factory methods to cut down on boilerplate and also enable the correct looping behavior - that's the part I hadn't understood about most of the parser methods from craftinginterpreters.com
Andrew Kesterson2025-01-12 23:22:09 -05:00
3a14609e44
Began writing the parser, moved the tokens out of the scanner into the parser
Andrew Kesterson2025-01-12 11:33:39 -05:00
7a64d28823
Identifiers matching reserved words that are not variables get their token type set to the reserved word
Andrew Kesterson2025-01-11 20:36:44 -05:00
e9be97396c
Got identifiers (including variable types) scanning working (including checking for reserved words)
Andrew Kesterson2025-01-11 20:30:53 -05:00
4a4e2cca1c
Working through craftinginterpreters.com. Got the basic scanner working.
Andrew Kesterson2025-01-11 19:12:42 -05:00