Add Custom Commands to the Interpreter

Description

Modify the Interpreter to be able to run programs with Custom Commands.

Rename the existing Program type to CommandSequence and add a new Project type that includes Custom Commands:

export type CommandSequence = Array<string>; export type Project = { customCommands: { [command: string]: CommandSequence }, program: CommandSequence };

Example project:

{ customCommands: { square: ["forward", "left", "forward", "left", "forward", "left", "forward"] }, program: ["square", "square"] }

Test cases:

  • Project with empty program and empty customCommands

  • Project with program command sequence but no customCommands

  • Project with program and customCommands

  • Program with undefined commands (no registered command handlers or custom commands)

  • Redefinition of built-in commands (command handlers)

  • Recursion

See the discussion of command redefinition and recursion at https://wiki.fluidproject.org/display/C2LC/Custom+Blocks

We should also rename our existing editors to CommandSequence...Editor rather than Program...Editor as they operate on command sequences in our new model.

Activity

Show:

Daniel Cho November 5, 2019 at 3:37 PM

Yeah, I realized that I was thinking way ahead as well. That sounds great thumbs up

Simon Bates November 5, 2019 at 3:32 PM

Yeah, we'll definitely want to support persistence of custom commands and programs. I think we can tackle that a little later, when our program/project model is more evolved. In the overall project plan, we've got persistence scheduled for the next milestone: milestone 3 January-June 2020.

Daniel Cho November 5, 2019 at 3:08 PM

We need to think about how we are going to store custom commands – maybe web storage API if we are planning to store them locally, and I think it is valuable approach to make them sharable to other people too. 

Won't Fix

Details

Assignee

Reporter

Created November 5, 2019 at 2:38 PM
Updated May 7, 2024 at 2:45 PM
Resolved May 7, 2024 at 2:45 PM

Flag notifications