In honor of Star Wars day, I've put together this small Python program I'm calling JediScript. JediScript is essentially a scrapped-down version of BrainFuck without input or looping. Here are the commands in JediScript.SlashWithSaber: Move forward on the tape.ParryBladeWithSaber: Move backward on the tape.StabWithSaber: Increment a cell.BlockBladeWithSaber: Decrement cell.UseForceWithHands: Output the current cell.Each command is semicolon ; separated, like so: StabWithSaber;UseForceWithHands. Here's an example input. This will output the character p.StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;StabWithSaber;UseForceWithHands;This is something that I threw together in about 20 minutes, so it's not the greatest, but I'd still appreciate a review.#!/usr/bin/env pythonJediScript, BrainFuck for Star Wars.May the 4th be with you.DEFAULT_SPLIT = ;Variables below this are environmentvariables for the user to modify.data_tape = [0 for _ in range(256)]tape_pos  = 0def increment_cell():    global data_tape    global tape_pos    data_tape[tape_pos] += 1 if data_tape[tape_pos] <= 127 else 0def decrement_cell():    global data_tape    global tape_pos    data_tape[tape_pos] -= 1 if data_tape[tape_pos] >= 0 else 0def move_forward():    global tape_pos    tape_pos += 1 if tape_pos <= len(data_tape) - 1 else 0def move_backward():    global tape_pos    tape_pos -= 1 if tape_pos >= 0 else 0def output_cell():    print chr(data_tape[tape_pos])Dictionary contains tokens that referencetheir relevant functions.TOKENS = {    SlashWithSaber: move_forward,    ParryBladeWithSaber: move_backward,    StabWithSaber: increment_cell,    BlockBladeWithSaber: decrement_cell,    UseForceWithHands: output_cell,}def execute_commands(tokenized_string):        Executes commands from the tokenized string.    tokenized_string - The tokenized string        for token in tokenized_string:        if token in TOKENS:            TOKENS[token]()def tokenize_input(string):        Tokenize a string into it's the form [ token, ... ]    string - The string to tokenize.        string = string.replace( , )    string = string.split(DEFAULT_SPLIT)    return stringdef get_user_input(prompt):        Get input from the user.    prompt - The prompt to be used.        while True:        string = raw_input(prompt)        string = tokenize_input(string)        execute_commands(string)if __name__ == __main__:    get_user_input(JediScript $ )
JediScript - May the 4th be with you
python;interpreter;language design
Why do you allow each cell of the tape to hold numbers from -1 to 128? seems like an odd range.in move_backward() why do you allow the tape to reach position -1?in move_forward() why do you allow the tape's position to be beyond the end of the tape?In general you should be using exclusive comparisons (without the =) as you'll make fewer mistakes.