Skip to the content.

AgentCrafter DSL Grammar

This document provides the formal grammar specification for the AgentCrafter Domain-Specific Language (DSL) used to define multi-agent reinforcement learning simulations.

simulation_block ::= "simulation:" simulation_config ;

simulation_config ::= llm_block? grid_block agent_block+ wall_block? ascii_wall_block? llm_wall_block? simulation_property* ;

llm_block ::= "useLLM:" llm_config_block ;

llm_config_block ::= llm_property+ ;

llm_property ::= "Enabled" ">>" boolean
               | "Model" ">>" string ;

grid_block ::= "grid:" grid_size ;

grid_size ::= number "x" number ;

wall_block ::= "walls:" wall_config ;

wall_config ::= wall_element+ ;

wall_element ::= line_block
               | block_property ;

line_block ::= "line:" line_config ;

line_config ::= line_property+ ;

line_property ::= "Direction" ">>" direction
                | "From" ">>" coordinate
                | "To" ">>" coordinate ;

direction ::= "\"horizontal\"" | "\"vertical\"" ;

block_property ::= "block" ">>" coordinate ;

ascii_wall_block ::= "asciiWalls:" string ;

llm_wall_block ::= "wallsFromLLM:" llm_wall_config ;

llm_wall_config ::= wall_llm_property+ ;

wall_llm_property ::= "Model" ">>" string
                    | "Prompt" ">>" string ;

agent_block ::= "agent:" agent_config ;

agent_config ::= agent_property+ ;

agent_property ::= "Name" ">>" string
                 | "Start" ">>" coordinate
                 | "Goal" ">>" coordinate
                 | learner_block
                 | trigger_block ;

learner_block ::= "withLearner:" learner_config ;

learner_config ::= learner_property+ ;

learner_property ::= "Alpha" ">>" number
                   | "Gamma" ">>" number
                   | "Eps0" ">>" number
                   | "EpsMin" ">>" number
                   | "Warm" ">>" number
                   | "Optimistic" ">>" number ;

trigger_block ::= "onGoal:" trigger_config ;

trigger_config ::= trigger_property+ ;

trigger_property ::= "Give" ">>" number
                   | "OpenWall" ">>" coordinate
                   | "EndEpisode" ">>" boolean ;

simulation_property ::= "Penalty" ">>" number
                      | "Episodes" ">>" number
                      | "Steps" ">>" number
                      | "ShowAfter" ">>" number
                      | "Delay" ">>" number
                      | "WithGUI" ">>" boolean ;

coordinate ::= "(" number "," number ")" ;

boolean ::= "true" | "false" ;

number ::= [0-9]+ ("." [0-9]+)? ;

string ::= "\"" [^\"]* "\"" ;

Grammar Elements

Core Structure

Configuration Blocks

LLM Configuration

Grid Configuration

Wall Configuration

Agent Configuration

Learner Configuration

Trigger Configuration

Simulation Control

Data Types

Primitive Types

Property Assignment