The SAGE Objective Editor Language

SAGE Objective Editor Language

The SAGE Objective Editor Language was implemented using Google’s Blockly library for building visual programming editors (Google, 2016). This section will describe the design of the language and the implementation of the editor that can be used to write assessments using the language.

Language Reference

The SAGE Objective Editor Language grammar is provided below. Terminals in this grammar are represented using bold font and described with more detail in the following section. The ↓ symbol represents a vertical connection between two blocks. The → symbol represents a horizontal connection between two blocks. Productions that have the suffix opt are optional. As assessment begins with the “assessment” non-terminal.

assessment:

    expectation ↓ trigger-listopt

expectation:

    expect → actual → assert → matcher

actual:

    actl-sprite
    actl-block
    actl-block-type
    actl-key-pressed
    actl-sprite-touch-sprite
    actl-sprite-touch-color

assert:

    asrt-should
    asrt-should-not

matcher:

    mtch-be-present
    mtch-be-on-x-y
    mtch-point-direction
    mtch-move-steps
    mtch-say

trigger-list:

    trigger
    trigger-list ↓ trigger

trigger:

    condition action

condition:

    cnd-if-pass
    cnd-if-fail

action:

    actn-say
    actn-include-block
    actn-exclude-block

Terminals

Every terminal in the grammar corresponds to a block that is described below.

expect

expect

The Expect blog signifies the beginning of an assessment. It connects horizontally to an actual block and connects vertically to a trigger block.

actl-sprite

actl-sprite

The Actual Sprite block is used to reference a sprite. It takes a single string argument for the ID of the sprite that is being referenced. It connects horizontally to an assert block.

actl-block

actl-block

The Actual Block block is used to reference a block. It takes a single string argument for the ID of the block that is being referenced. It connects horizontally to an assert block.

actl-block-type

actl-block-type

The Actual Block Type block is used to reference a block type. It takes a single string argument for the type of block that is being references. It connects horizontally to an assert block.

actl-key-pressed

actl-key-pressed

The Actual Key Pressed block is used to express a mapping between a key on a keyboard being pressed and a sprite. It takes two arguments. The first argument must be selected from a drop down menu that is pre-populated with single keyboard characters. The second argument is of type string for the ID of the sprite that is being referenced. It connects horizontally to an assert block.

actl-sprite-touch-sprite

actl-sprite-touch-sprite

The Actual Sprite Touching Sprite block is used to express a mapping between two sprites. It takes two arguments. Each argument is of type string for the ID of each of the sprites that are being referenced. It connects horizontally to an assert block.

actl-sprite-touch-color

actl-sprite-touch-color

The Actual Sprite Touching Color block is used to express a mapping between a sprite and a color. It takes two arguments. The first argument is of type string for the ID of the sprite being referenced. The second argument is from a drop down menu that is pre-populated with a list of colors. It connects horizontally to an assert block.

asrt-should

asrt-should

The Should block is used to express an assessment where an action should occur. It connects horizontally to a matcher block.

asrt-should-not

asrt-should-not

The Should Not block is used to express an assessment where an action should not occur. It connects horizontally to a matcher block.

mtch-be-present

mtch-be-present

The Be Present block is used to express an assessment that verifies a sprite, block, or block type is present.

mtch-be-on-x-y

mtch-be-on-x-y

The Be on X and Y block is used to express an assessment that verifies a sprite is on specific coordinate in the Scratch stage. It takes two arguments. Each argument is of the integer data type and represents the X or Y coordinate.

mtch-point-direction

mtch-point-direction

The Point in Direction block is used to express an assessment that verifies a sprite is pointing in a specific direction. It takes one argument. The argument must be chosen from a drop down menu that is pre-populated with the following options: right, left, down, up.

mtch-move-steps

mtch-move-steps

The Move Steps block is used to express an assessment that verifies a sprite moves a certain number of steps. It takes one argument. The argument is of type integer and represent the number of steps.

mtch-say

mtch-say

The Say block is used to express an assessment that verifies the sprite says, or prints a message to the screen. It takes one argument. The argument is of type string and represents the message.

cnd-if-pass

cnd-if-pass

The block If Pass is used to express a trigger that is invoked if the assessment passes. It connects vertically to an expect or another trigger block. It connects horizontally to an action block.

cnd-if-fail

cnd-if-fail

The block If Fail is used to express a trigger that is invoked if the assessment fails. It connects vertically to an expect or another trigger block. It connects horizontally to an action block.

actn-say

actn-say

The Say block is used to say, or print a message on the dashboard if the previous trigger is invoked. It takes one argument. The argument is of data type string and represents the message that should be printed on the dashboard.

actn-include-block

actn-include-block

The Include Block block is used to include one block on the Scratch palette builder if the previous trigger is invoked. It takes one argument. The argument is of data type string and represents the ID of the block that should be included.

actn-exclude-blocks

actn-exclude-blocks

The Exclude Block block is used to exclude one block on the Scratch palette builder if the previous trigger is invoked. It takes one argument. The argument is of data type string and represents the ID of the block that should be excluded.

Editor

The SAGE Objective Editor Language editor is implemented using HTML and JavaScript. It extends the Blockly Code editor example on the Blockly website (Google, 2016) by enabling users to upload assessments to the assessment server. When a user requests that an assessment be uploaded, the editor executes an HTTP POST request against the assessment server with the XML-encoded assessments as the HTTP request body.