A mini programming language project that includes a Python interpreter, enabling robots to navigate in a 2D grid world, collect keys, open doors, and reach the exit.
Vault Runner implements a simple programming language that allows users to write programs to control robot behavior in a 2D grid world. The robot can only see one cell ahead and must use sensors and actions to complete tasks.
- Mini Programming Language: No more than 20 keywords, supports conditional statements and loops
- 2D Grid World: Contains floors, walls, keys, doors, and exits
- Sensor System: Whether the front is clear, whether on a key, whether at a door, whether at exit
- Action System: Move, turn, pick up keys, open doors
- Safety Limits: Maximum nesting depth of 10 levels, loop limit of 50 iterations
TheVaultRunner/
├── main.py # Main program entry point
├── interpreter.py # Interpreter (Tokenizer, Parser, Executor)
├── bot.py # Robot implementation
├── world.py # World model
├── examples/ # Example programs
│ ├── corridor.runner
│ └── collect_and_open.runner
├── tests/ # Test cases
│ └── test_world.py
└── README.md # Project documentation
# Run corridor example
python main.py examples/corridor.runner --verbose
# Run collect keys and open door example
python main.py examples/collect_and_open.runner --verbose# Run all tests
python -m pytest tests/ --verbose
# Run specific test file
python -m pytest tests/test_world.py --verboseMOVE,LEFT,RIGHT,PICK,OPEN- 5 actionsIF,ELSE,ENDIF- 3 conditional statementsLOOP,ENDLOOP,TIMES- 3 loop statementsFRONT_CLEAR,ON_KEY,AT_DOOR,AT_EXIT,HAVE_KEY- 5 detection methodAND,OR,NOT- 3 logical operatorsEND- 1 ending action
LOOP 50:
IF FRONT_CLEAR:
MOVE
ELSE:
RIGHT
ENDIF
ENDLOOP
- Nesting Depth: Maximum 3 levels (IF/LOOP nesting)
- Loop Limit: Maximum 50 iterations
- Keyword Count: No more than 20
- Variable Limits: Can only use sensor outputs, literals, and one accumulator flag
- Token Count: 15
- Description: Simple right-wall-following strategy, loop limit of 50 iterations
- Token Count: 25
- Description: Prioritize picking up keys, open doors when encountering them with keys, until reaching the exit
- ✅ Basic framework structure
- ✅ World model (2D grid)
- ✅ Robot implementation (movement, turning, sensors)
- ✅ Interpreter (Tokenizer, Parser, Executor)
- ✅ Example programs
- ✅ Automated test cases
- ✅ Constraint checking (nesting depth, loop limit)
- Richer Conditional Expressions - Support complex logical combinations
- Macro and Function Support - Subroutine definition and calling
- Path Planning Algorithms - A* and other intelligent navigation
- Visualization Output - Step display and world state
- Multi-key Multi-door Support - Extend world model complexity
- Support richer conditional expressions and variables
- Add macro or function/subroutine support
- Better path planning algorithms as built-in macros
- Visualized step output
- Support for multiple keys or multiple doors
- Graphical interface support
- Python 3.10+
- Type annotations
- pytest (testing framework)
- Fork the project
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is for learning and research purposes only.