Robot Language

Takeoka@AXE

in Japanese(にほんご)
last update: 1999/DEC/22
KRobot : the Robot Language Interpreter in KVM

  1. Robot
  2. KRobot feature

    What is Robot Laguage


    • The language for drawing recursive curves
    • Turtle Graphics based
    • Very simple programming language
    • Robot has an ACC for holding an iteration count
    • The original Robot specification and implimentation:
      Litchen Wang,
      An Interactive programming Language for control of robots, DDJ, Vol.2, Issue 10, pp.60-63 (1977).




    Syntax


    <Expression> ::= <Term><Funcion> | <Term>(<Expression>) | <Expression><Expression>
    Robot executes an <Expression>.
    <Term> specifies an iteration count of following one.
    <Term> ::= a | <Number> | nothing
    nothing means 1.
    "a" means a content of Acc.
    <Number> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <Number><Number>
    0 means 2^31.
    <Function> ::= <BuiltinFunction> | <UserFunction>
    <BuiltinFunction> , <UserFunction> as follows.

    Builtin Functions


    +
    Increment Acc
    -
    Decrement Acc
    h
    Move to the center of the display. (Home)
    n
    set direction up. (North)
    c
    clear display
    r
    rotate right 45 degree
    f
    forward 1 step with drawing a line.
    j
    forward 1 step without drawing a line. (Jump)
    t(<NonZeroExpression>)(<ZeroExpression>)
    if Acc!=0 then execute <NonZeroExperssion>
    if Acc==0 then execute <ZeroExperssion>
    dF(<DefunExpression>)
    define <UserFunction> F as <DefunExpression>.
    The character F is a name of <UserFunction>.

    Reserved Words


    a
    Acc placed as term, means a value of ACC.
    Robot has an ACC.
    (ACC holds a value , 0-2^31)
    :
    indicates commnad, preceeding an command.
    Commnad is a special feature of KRobot.
    There is no command in original Robot specification.

    UserFunction


    You can use a lower case character as a name of your UserFunction.
    The character of UserFunction name must not be reserved.

    Commands


    Commnad is a special feature of KRobot.
    Commands are order to the execution environment (Top-Level).

    :d
    display all <UserFunction>.
    :n
    clear all <UserFunction>. (New)
    :<Trem>s
    set dots of a step as <Trem>.
    To execute command, you input a command line and tap a "DoIt" button.

    An execution of command has side-effect to the stack of KRobot.
    So, after execution of command , you cannot "Cont".

    Buttons


    Clear
    Clear display
    Getd
    Get and display the Definitions of <UserFunction> .
    This button has no effect to the stack of KRobot
    CI
    Clear the Input line
    ?
    display help
    DoIt
    exectute the input line
    Cont
    resume stopped execution
    Stop
    Stop the execution

    Startup execution


    Start up execution of a Memo.
    KRobot read and execute a Memo of Palm-standerd , at start up time.
    The Memo must starts a ";-robot" line.

    Execution Example


    Dragon curve

    dx(t(-x6rk+)(f))
    dk(t(-x2rk+)(f))
    chna-10+x

    Hilbert curve

    du(t(-vfxuyfufxv+)(x))
    dv(t(-uyfvfxvyfu+)(y))
    dx(6r)
    dy(2r)
    chna-5+2ru

    Sierpinsky curve

    dx(t(-xfxufuxfx+)(v))
    du(5r)
    dv(2r)
    dy(6r3r4(fx))
    chna-2+y


    KRobot : the Robot Language Interpreter in KVM

    AXE, Inc Home Page