Close

Debugging and Loops

A project log for Pico Picow

A tiny handheld dev console, with a 12 button keypad, Pi Pico W inside, and 128x64 OLED.

gordonGordon 01/02/2025 at 23:530 Comments

I added a debugging function because it was getting crazy to debug when something went wrong. Parsing directly from a string takes a lot of steps. Now if I have debugging on, if there is an error I can see exactly what went wrong (sorta).

I added the "L" and "LG" builtin KEYWORDS for LOOP and LOOP_GROUP. Here is how they work:

0K 100 : <O 0K>  L

@ <0K 100 : O 0K> LG

The code enclosed with "< >" will be looped.

"L" will scroll the program counter until it reaches a SEPERATOR ":" symbol.

"LG" will scroll the program counter back until it reaches a GROUP "@" symbol, this allows for repeating a GROUP as many times as wanted. All KEYWORDS being global, effectively this can be very useful.

it's pretty simple and works as intended.

I also have assigning a value of a KEYWORD to another keyword setup:

12K 2K

The above sets the value of 12K to the value of 2K. I need to work on parsing math operators next. In the original GORK, my plan for the rules of math operators to be as such:

  1. A string KEYWORD or literal can only be added to or have something added to it, e.g. concatenation
  2.  If a string of keywords and literals are added together, and there is a string in there, the final result will be a string. If there is no string, if there are no floats, it will be an integer, otherwise it will be a float.
  3. Adding 1 to keyword 1K looks like this "1K + 1", there is no need for ++ or += or "1K = 1K+1" like in C or Python. The goal is to reduce as many characters needed to write a program.
    4K 12  - 2 + $ Day's until January $ + 12 + $th$
    [VALID:  4K  = $10 Day's until January 12th$ ) ]
    
    2K 128
    2K + 4 / 12 - 16 * 1.234
    [VALID: 2K  = 108.589]
    
    [INVALID OPERATIONS]
    4K $Howdy$ - 10

Discussions