🏎️ PitScript Playground 🏎️

Your Formula 1 themed programming language interpreter

📝 Code Editor 🏎️
📺 Output 📊
Ready to start your PitScript race! Click 'Start Race' to begin...

📚 Documentation

🎯 Language Features

  • Variables and arithmetic operations
  • User-defined functions with parameters
  • Error handling with DRS zones
  • Grid system (list) with 20 positions (p1-p20)
  • Integer-only data type for maximum speed 🏎️
  • Case insensitive commands

📋 Important Rules

  1. Always start with: Its lights out and away we go
  2. Always end with: retire the car
  3. Each command goes on a separate line
  4. Keep spaces between reserved words, variables and operators
  5. Grid definitions must be between grid start and grid end

🔧 Command Reference

Radio
Print command - outputs variable value or text
radio <variable or text>
Strat
Define and assign value to a variable
strat <var_name> <value>
Grid Start/End
Define grid positions (p1-p20)
grid start

p1 100

grid end
Pit
Create user-defined functions
pit <func_name> [args]
Crash
End function definition
crash
Box Box
Call user-defined functions
box box <func_name> [args]
DRS
Start try block for error handling
drs
Yellow Flag
Start except block
yellow flag
Green Flag
End try-except block
green flag

💡 Example Programs

🌟 Hello World

ITS LIGHTS OUT AND AWAY WE GO
RADIO Hello World
RETIRE THE CAR

🧮 Arithmetic Operations

ITS LIGHTS OUT AND AWAY WE GO
STRAT speed 100
STRAT boost speed * 2
STRAT weight 500
STRAT reduce weight / 5
RADIO speed
RADIO boost
RADIO weight
RADIO reduce
RETIRE THE CAR

📊 Grid (List) Usage

ITS LIGHTS OUT AND AWAY WE GO
strat lewis 44
grid start
p1 100
grid end
radio p1
strat boost p1 * lewis
radio boost
retire the car

🔧 User-Defined Functions

ITS LIGHTS OUT AND AWAY WE GO
STRAT speed 100
PIT add2 var1
STRAT var1 var1 + 2
CRASH
BOX BOX add2 speed
RADIO speed
RETIRE THE CAR

⚠️ Error Handling

ITS LIGHTS OUT AND AWAY WE GO
DRS
STRAT max 100
STRAT boost speed / 0
RADIO speed
RADIO boost
YELLOW FLAG
RADIO something is wrong I can feel it
GREEN FLAG
RETIRE THE CAR