Page MenuHomePhabricator

Updated 560 Days AgoPublic

Milestones after v0.1 are tentative and subject to change

This is the wiki format of the Ratscript development roadmap. It should be kept in sync with the Ratscript Projects Workboard.

When coding in exit codes for Ratscript, follow the sysexits conventions as mentioned in Crafting Interpreters.

v 0.1

  • Parsing/lexing via tree walk method.
  • Command line console
    • Start with command line to enter text and print / return same text
      • Output cursor #>
    • Plug parser into command line script as functional
    • Eventually make a nicer gui interface? (Related but not in v0.1)
  • Math functionality:
    • Parsing and tokenizing numbers. Use SIMPLExpress, not regex
      • First integer (int), then decimal (number)
    • Parsing and tokenizing basic math operators (+, -, *, /, %, ^, open and close () Keeping in mind that parenthesis will need to be parsed for all kinds of things, not just math.)
      • Include - as a negation, that is, to create a negative number; parse correctly compared to using as a subtractor
      • Include precedence/order of operations per the standard P[E][MD%][AS] (Parenthesis, Exponent, Multiplication, Division, Modulo, Addition, Subtraction)
        • 1 + 2 * 3 occurs as 1 + (2 * 3)
    • Display an error if it can't do these things
    • Display a result if it can

v 0.2

  • Console read script file as well as accepting direct input
  • Print Statement
    • Crafting Interpreters "bakes this in", rather than making it a core library function. How should we handle it?
    • If we find that we need to postpone working on print statements, shift to return statements
  • Conditional statements:
    • Start with if, then include while, for, possibly switch
      • if statements should be simple to start, for example...
if 1 + 1 == 2
;  print("Magic!")
; # Alternatively, if we postpone print, return True
  • Start with ==, then comparisons:
    • True/false logic (if !true == false)
    • less < than, less_than <= or_equal, greater > than, greater_than >= or_equal, exactly == equal, not != equal
    • not, or/and logic (if 1 + 1 == 2 or 1 + 1 == 3), (if 1 + 1 == 2 and 2 + 2 == 4)
    • is - type checking
  • This will have to include handling the subordination operator ;

v 0.3

  • Variable assignment (will need to include memory handling)
    • Start with integer (int), decimal (number), string
    • make - variable assignment
      • Type casting as <type> - worth including from the start, probably.
    • let - temporary variable
    • define - constant
    • Null variable
    • Note: ratscript/old/ folder has some memory handling stuff
  • Verify consistency with mutability/immutability rules described in wiki
  • Verify consistency with typecasting rules

Unprioritized milestones and breakdowns

Any milestones needed but not currently prioritized can be indicated here. Feel free to include notes about potential implementation details.
  • Conditionals, functions, etc, in general, terminated by end (anything with subordination)
  • Line of code terminated by newline unless extended with ...
  • Booleans
  • Trileans
  • String handling (presumably via pawlib and onestring?)
    • String concatenation folded into the + operator
    • String formatting (See Python f-string and/or %s syntax?)
  • Switch statements if not handled in v 0.2
  • Functions, function definition
    • If left untouched in v 0.2, return (automatically return non-value if no defined return)
  • Further variable definitions - each data type will need some degree of its own memory assignment, etc. Some or all of this may end up in v0.3.
    • Collections
      • Array, list, linked list, queue, stack, dictionary, set....
    • Functional programming
      • Comprehensions (list, dictionary, set), lambdas, decorators, generators, and coroutines
  • Other data types untouched in v 0.1-0.3 (bytes, float, vector, matrix, datetime, etc.)
  • Tests
  • Classes, class definition, inheritance
  • Attributes
  • Read/write to files
  • try / catch statements
  • with statements
  • Error handling
  • Standard Library
Last Author
Last Edited
Jul 16 2021, 5:22 PM

Event Timeline

ardunster published a new version of this document.

Reading through this, at the moment, it looks like a good start. You'll probably have an idea of which direction to take 0.2 depending on how 0.1 goes.

If it wouldn't be adding too much, you may consider adding the modulo (%) and exponent (^) operators into 0.1 as well. It'll be easiest to implement those then.

ardunster edited the content of this document. (Show Details)