This shows you the differences between two versions of the page.
en:techinformation [2016/01/01 22:42] |
en:techinformation [2020/02/28 10:46] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Developer and Technical ===== | ||
+ | ==== Overview ==== | ||
+ | |||
+ | BASIC-256 programs are first compiled to byte code using LEX and YACC, and then run by interpreting the byte code in a stack machine. Adding functions is a simple matter of adding a byte code, letting LEX and YACC know how to parse the syntax, and coding the appropriate instruction in the interpreter. If you've never written a compiler or interpreter, | ||
+ | |||
+ | Please keep in mind that BASIC-256 is a teaching language for children (target ages 7-9), so we'd like to stay away from advanced concepts as much as possible. While it would be fun to make BASIC-256 a powerful high-level language, there are already much better languages that exist to fill that need: Python, Scheme. | ||
+ | |||
+ | ==== To do ==== | ||
+ | |||
+ | - Real-time error checking in the editor (parse each line just after it's typed) | ||
+ | |||
+ | ==== The life of a BASIC-256 program ==== | ||
+ | |||
+ | - BASIC program parsed into tokens by LEX | ||
+ | - LEX feeds tokens to YACC | ||
+ | - YACC determines if line is valid syntax. If so, it adds the appropriate byte codes to the byte-coded program | ||
+ | - If no syntax errors occur, the C++ portion of the program interprets the byte code one instruction at a time, using a stack machine | ||
+ | - Run time errors halt program execution and display an error message on the screen | ||
+ | |||
+ | ==== Graphical Output ==== | ||
+ | All graphing functions are performed on a buffer, which is subsequently written to the screen immediately after each operation. This is intentionally inefficient. The " | ||
+ | |||
+ | This is an ideal illustration of concessions made in BASIC-256 to keep things simple. We're interested in kids being able to see their dots move across the screen without having to explain double-buffering and multi-threading. We also want to allow them to write games like Pong that test for collisions using basic geometric formulas and draw the ball and paddles in a single loop. The current approach allows for this. | ||
+ | |||
+ | Note: To speed things up for children doing more advanced programs, the [[fastgraphics|FASTGRAPHICS]] mode has been added. When in this mode, the display will only be updated when the BASIC program uses the [[refresh|REFRESH]] command. This allows kids to benefit from double-buffering without having to understand it completely. | ||