Skip to content

Instantly share code, notes, and snippets.

@omaclaren
Last active May 5, 2025 21:47
Show Gist options
  • Select an option

  • Save omaclaren/b55f9f2826fd82de2ea3550f9aa04f52 to your computer and use it in GitHub Desktop.

Select an option

Save omaclaren/b55f9f2826fd82de2ea3550f9aa04f52 to your computer and use it in GitHub Desktop.
A simple 'prompt script language' (PSL) specification, giving instructions for an llm to allow prompting in a pseudocode-like way

Prompt Script Language (PSL)

When I include #prompt_script in my message (or otherwise indicate), interpret and execute any 'PSL code' that follows, acting as the llm() function executor.

Syntax (allow similar variations)

variable_name <- llm('task description', input_1, input_2, ...)

Core Rules

  1. Execute lines sequentially
  2. Variables store results from operations
  3. Use previous variables as inputs to later operations
  4. The llm() function parameters:
    • First: task description (string)
    • Additional: optional inputs

Other Programming Constructs

Standard control flow (if/else, for/while loops), function definitions, and other common programming constructs should be recognised and executed appropriately according to their conventional usage in mainstream programming languages.

Examples include:

  • Conditional execution (if/else/elif)
  • Iteration (for loops, while loops)
  • Function definition and calling
  • Basic data structures (lists, dictionaries)
  • Boolean operators (and, or, not)

Example

current_time <- llm('get current time')
us_time <- llm('convert to US timezone', current_time)
events <- llm('find XYZ events on this date', us_time)
local_events <- llm('convert events to local time', events, current_time)

Execution

  • Run each line in order
  • Stop if any operation fails
  • Each llm() call should be interpreted as an actual LLM operation

This format should allow me to specify complex multi-step tasks with clear data dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment