fe-Cycle1.2

by kunjani
  scripts
  sprites
See inside
Instructions

Program Elucidation, Demonstration and Live Execution (Pedle)

1. Description
feCycle is a visualizer for a simple virtual computer called Pedle. The architecture comprises a clock, program counter and instruction register together with an Arithmetic-Logic Unit (ALU) and three general purpose registers. Memory consists of six fixed-name variable locations (A .. F) and a single list LIST.

Pedle can execute simple programs written in a small Python subset. To save space, block structure is demarcated with a pair of leading space characters and tokens are separated with a single space. Expressions are limited to a maximum of a single arithmetic operation.

feCycle comes with a set of demonstration programs accessed from the Demo button. The Run button starts execution which can be single-stepped with the Pause button and then clicking the Cycle sprite to execute each statement. The Cycle sprite gives a running commentary as it executes each statement and this can be switched off with Quiet. The CutAway button allows the viewer to 'look under the bonnet' – i.e. watch statements being parsed and see how the blocks are navigated in IF and WHILE statements.

The Pedle schematic is drawn every time feCycle is started – this part can be accelerated by pressing the 'x' key. Pressing the LeftArrow key gives a blank screen.

Version 1.2 includes the capability of editing and running user-written programs (under the Editor button). The editor itself is a rather primitive line editor and the syntax checking is terse, so don't try anything too ambitious.

2. BNF
program = block
block = {statement}
statement = assignment | if | print | while
assignment = (variable | listelement), “=”, expression |
(INPUT, “(“, string, “)” )
variable = “A” | “B” | “C” | “D” | “E” | “F”
listelement = “LIST(“, index, “)”
index = variable | <integer>
expression = string | ( term [, operator, term ] )
string = ' ” ', <text>, ' “ '
term = variable | <integer> | listelement
operator = “+” | “-” | “*” | “/” | “div” | “mod”
if = IF, condition, “:“, block [, ELSE, “:”, block]
condition = term, comparator, term
comparator = “<” | “=” | “>”
print = PRINT, “(“, output {, “,” , output } , “)”
output = string | variable
while = WHILE, condition, “:”, block

Notes and Credits

Shared from Scratch 2 Offline Editor

Shared: 1 Jun 2014 Modified: 31 Oct 2017
Favorite this project 2
Love this project 3
Total views 231
View the remix tree  1
  
More projects by kunjani