Whitespace is never significant, except to separate two symbols or within a string or escaped symbols.
Regular expression for symbol is [-a-z0-9A-Z]* or |[^|]*|.
Number is [-]*[0-9][0-9]* optional [d]*[0-9][0-9]*,
[+]*[0-9][0-9]*.
String is "[^"]*".
Comments extend from ; to end of the line, or may be everything
enclosed between #| and |# (which nest properly).
form ::= module-form
| ( include module-name [ variant-setting ]* )
| ( if test-form [ symbol ] )
| ( else [ symbol ] )
| ( end-if [ symbol ] )
| world-form
| area-form
| side-form
| side-defaults-form
| independent-units-form
| doctrine-form
| player-form
| agreement-form
| unit-form
| unit-defaults-form
| scorekeeper-form
| exu-form
| evt-form
| unit-type-form
| terrain-type-form
| material-type-form
| advance-type-form
| namer-form
| table-form
| add-form
| imf-form
| palette-form
| color-form
| ( define symbol value )
| ( set symbol value )
| ( undefine symbol value )
| ( print value )
| value
module-form ::= ( game-module [ module-name ]
[ game-module-property-binding ]* )
module-name ::= string
game-module-property-binding ::= ( game-module-property-name value )
game-module-property-name ::=
base-game | title | blurb | picture-name | instructions
| notes | design-notes | program-version
| base-module | default-base-module | variants | version
variant-definition ::=
( [ string ] var-type [ var-default ] [ var-range ] [ var-clause ]* )
var-type ::= world-size | world-seen | see-all
| sequential | real-time | symbol
var-default ::= value
var-range ::= ( value value )
var-clause ::= ( [ string ] value [ form ]* )
variant-setting ::= ( var-type value )
world-form ::= ( world [ circumference ] [ world-property-binding ]* )
world-property-binding ::= ( world-property-name value )
world-property-name ::=
axial-tilt | circumference | day-length | year-length
circumference ::= value
area-form ::= ( area [ width [ height ] ] [ area-restriction ]
[ area-property-binding ]* )
area-restriction ::= ( restrict width height a-x a-y )
area-property-binding ::= ( area-property-name value )
| ( terrain [ layer-subform ]* [ string ]* )
| ( aux-terrain terrain-type [ layer-subform ]* [ string ]* )
| ( features feature-list [ layer-subform ]* [ string ]* )
| ( material material-type [ layer-subform ]* [ string ]* )
| ( people-sides [ layer-subform ]* [ string ]* )
| ( control-sides [ layer-subform ]* [ string ]* )
| ( elevations [ layer-subform ]* [ string ]* )
| ( temperatures [ layer-subform ]* [ string ]* )
| ( winds [ layer-subform ]* [ string ]* )
| ( clouds [ layer-subform ]* [ string ]* )
| ( cloud-bottoms [ layer-subform ]* [ string ]* )
| ( cloud-heights [ layer-subform ]* [ string ]* )
area-property-name ::= width | height | latitude | longitude | cell-width
layer-subform ::= ( constant n )
| ( subarea a-x a-y width height )
| ( xform mul add )
| ( by-bits )
| ( by-char string )
| ( by-name name-list )
width ::= value
height ::= value
a-x ::= value
a-y ::= value
n ::= value
mul ::= value
add ::= value
side-form ::= ( side [ side-id ] [ side-property-binding ]* )
side-defaults-form ::= ( side-defaults [ side-property-binding ]* )
side-property-binding ::= ( side-property-name value )
side-property-name ::=
name | long-name | short-name | noun | plural-noun
| adjective | color | emblem-name | names-locked
| class | active | status
| advantage | advantage-min | advantage-max
| controlled-by | trusts | trades | next-numbers | unit-namers
| feature-namers | tech | init-tech | terrain-view | unit-view
| unit-view-dates | turn-time-used | total-time-used | timeouts
| timeouts-used | finished-turn | willing-to-draw
| doctrines | doctrines-locked
| self-unit | priority | scores | ui-data | ai-data | player
doctrine-form ::= ( doctrine ... )
player-form ::= ( player [ player-id ] [ player-property-binding ]* )
player-id ::= number
player-property-binding ::= ( player-property-name value )
player-property-name ::= name | config-name | display-name | ai-type-name
| password | initial-advantage
agreement-form ::= ( agreement [ agreement-id ] [ agree-prop-bdg ]* )
agreement-id ::= value
agree-prop-bdg ::= ( agreement-property-name value )
agreement-property-name ::= type-name | title | terms | drafters
| proposers | signers | willing-to-sign | known-to | enforcement
| state
unit-form ::= ( unit [ unit-id ] [ unit-property-bdg ]* )
| ( unit-type-name u-x u-y u-side [ unit-property-bdg ]* )
unit-defaults-form ::= ( unit-defaults [ reset ] [ unit-property-bdg ]* )
unit-property-bdg ::=
( unit-property-name value )
| ( act action-type-name [ action-property-binding ]* )
| ( plan plan-type-name [ plan-property-binding ]* )
| ( task task-type-name [ task-property-binding ]* )
| ( x [ unit-x-property-binding ]* )
unit-property-name ::=
@ | # | cp | cxp | hp | in | m | mo | n | nb
| opinions | s | tp | z
unit-id ::= value
u-x ::= value
u-y ::= value
u-side ::= value
unit-x-property-binding ::=
( unit-x-property-name value )
( symbol value )
unit-x-property-name ::= appear | disappear
action-type-name ::=
add-terrain | alter-terrain | attack | build
| capture | change-side
| change-type | create-at | create-in | detonate | disband
| enter
| fire-at | fire-into | move | none | overrun | produce
| remove-terrain | repair | research | toolup | transfer
| transfer-part
action-property-binding ::=
( action-property-name value )
action-property-name ::= a | aa | acp | acp0 | am
plan-type-name ::=
defensive | exploratory | none | offensive | passive | random
plan-property-binding ::=
( plan-property-name value )
| ( goal goal-type-name ... )
plan-property-name ::=
ai-control | asleep | delayed | formation | goal | reserve
| supply-alarm | supply-is-low
goal-type-name ::=
cell-is-occupied | has-material-type | has-unit-type
| has-unit-type-near | keep-formation | lost-game
| no-goal | positions-known | vicinity-is-held
| vicinity-is-known | won-game | world-is-known
task-type-name ::=
build | capture | do-action | hit-position | hit-unit
| move-dir
| move-to | none | occupy | pickup | repair | research
| resupply | sentry
scorekeeper-form ::= ( scorekeeper [ sk-id ] [ sk-property-binding ]* )
sk-id ::= value
sk-property-binding ::= ( sk-property-name value )
sk-property-name ::=
applies-to | do | initial | known-to | messages | title
| trigger | triggered | when
sk-when ::= after-action | after-event | after-turn | before-turn
exu-form ::= ( exu id type x y side [ exu-property-binding ]* ) exu-property-binding ::= ( exu-property-name value ) exu-property-name ::= n | nb | z evt-form ::= ( evt turn evt-type-name observers [ value ]* )
evt-type-name ::=
action-done | action-error | action-ok
| cannot-do | cannot-leave-world | capture-failed
| capture-succeeded | destination-full | fire-into-outside-world
| game-ended | game-restarted | game-saved
| game-started | insufficient-acp | insufficient-material
| insufficient-mp | log-ended | log-started
| overrun-failed | overrun-succeeded | side-joined
| side-lost | side-withdrew | side-won
| too-far | too-near | unit-acquired
| unit-assaulted | unit-captured | unit-completed
| unit-created | unit-damaged | unit-disbanded
| unit-garrisoned | unit-killed | unit-left-world
| unit-moved | unit-name-changed | unit-started-with
| unit-starved | unit-type-changed | unit-vanished
| unit-wrecked
unit-type-form ::=
( unit-type unit-type-name [ unit-type-property-binding ]* )
unit-type-name ::= symbol
unit-type-property-binding ::= ( unit-type-property-name value )
unit-type-property-name ::=
acp-damage-effect | acp-max | acp-min
| acp-per-turn | acp-per-turn-max | acp-per-turn-min
| acp-season-effect | acp-temperature-effect
| acp-to-change-side
| acp-to-detonate | acp-to-disband | acp-to-fire
| acp-to-move | acp-to-transfer-part | action-priority
| already-seen | already-seen-independent | assign-number
| available | can-be-self | capacity | char | color
| consumption-temperature-effect | country-units-max
| cp | cp-per-self-build | cp-to-self-build | cxp-max
| cxp-on-capture-effect
| description-format | detonate-on-death | direct-control
| elevation-at-max-range | free-acp
| free-mp | generic-name | has-opinions | help
| hit-falloff-range
| hp-max | hp-per-detonation | hp-per-disband | hp-recovery
| image-name
| independent-growth-chance | independent-near-start
| independent-takeover-chance | initial-seen-radius | long-name
| move-range | mp-to-leave-world | name | name-internal | namer
| notes | occupant-total-max | parts-max | point-value
| possible-sides | range | range-min
| revolt-chance | see-always | see-occupants
| self-changeable | self-resurrects | short-name
| speed | speed-damage-effect | speed-max
| speed-min | speed-wind-angle-effect | speed-wind-effect
| spot-action | spy-chance | spy-range
| stack-order | start-with | tech-from-ownership
| tech-leakage | tech-max | tech-per-turn-max
| tech-to-build | tech-to-own | tech-to-see
| tech-to-use | temperature-attrition | type-in-game-max
| type-per-side-max | unit-growth-chance | unit-takeover-chance
| vision-bend | vision-range | wrecked-type
| zz-b | zz-bb | zz-bw | zz-c | zz-cc | zz-cm | zz-transport
terrain-type-form ::=
( terrain-type terrain-type-name [ terrain-type-property-bdg ]* ) )
terrain-type-name ::= symbol
terrain-type-property-bdg ::= ( terrain-type-property-name value )
terrain-type-property-name ::=
alt-percentile-max | alt-percentile-min
| capacity | char | clouds-max | clouds-min
| country-growth-chance
| country-people-chance | country-takeover-chance
| country-terrain-max | country-terrain-min
| elevation-max | elevation-min
| help | image-name | independent-people-chance
| liquid | maze-passage-occurrence | maze-room-occurrence
| name | notes | occurrence | people-max
| river-chance | subtype | subtype-x
| temperature-average | temperature-max | temperature-min
| temperature-variability | thickness | wet-percentile-max
| wet-percentile-min | wind-force-average | wind-force-max
| wind-force-min | wind-force-variability | wind-variability
| zz-fr
material-type-form ::=
( material-type material-type-name [ m-type-property-binding ]* ) )
material-type-name ::= symbol
m-type-property-binding ::= ( m-type-property-name value )
m-type-property-name ::=
char | help | image-name | initial-treasury
| name | notes | people | resource-icon | treasury
advance-type-form ::=
( advance-type advance-type-name [ m-type-property-binding ]* ) )
advance-type-name ::= symbol
a-type-property-binding ::= ( a-type-property-name value )
a-type-property-name ::=
char | help | image-name | name | notes | occurrence | rp
namer-form ::= ( namer [ namer-id ] naming-method state )
namer-id ::= value
naming-method ::=
junky
| ( random [ string ]* )
| ( grammar symbol number [ grammar-rule ]* )
grammar-rule ::= ( symbol ( [ rule-type ] [ weight ] data )
rule-type ::= any | or | reject | capitalize
state ::= value
table-form ::= ( table table-name [ add ] [ table-clause ]* )
table-clause ::=
value
| ( type-or-types type-or-types value )
table-name ::=
uu-table-name | ut-table-name | um-table-name
| tt-table-name | tm-table-name | mm-table-name
uu-table-name ::=
| acp-for-retreat | acp-occupant-effect | acp-to-attack
| acp-to-be-fired-on | acp-to-build | acp-to-capture
| acp-to-change-type | acp-to-create | acp-to-defend
| acp-to-enter-unit | acp-to-repair | acp-to-research
| acp-to-toolup | attack-range | attack-range-min
| bridge | build-range | can-enter-independent
| capture-chance | control-chance | control-chance-adjacent
| control-chance-at | control-range | cp-on-creation
| cp-per-build | create-range | cxp-per-capture
| cxp-per-combat | damage | damage-cxp-effect
| detonate-on-approach-range | detonate-on-capture
| detonate-on-hit | detonation-damage-adjacent
| detonation-damage-at | detonation-unit-range
| ferry-on-departure | ferry-on-entry | hit-at-max-range-effect
| hit-chance | hit-cxp-effect | hp-min
| hp-per-repair | hp-to-garrison | hp-to-repair
| independent-capture-chance
| mp-to-enter-unit | mp-to-enter-zoc
| mp-to-leave-unit | mp-to-leave-zoc | mp-to-traverse-zoc
| occupant-can-construct | occupant-can-have-occupants
| occupant-combat | occupant-escape-chance | occupant-max
| occupant-vision | protection | retreat-chance | road-chance
| scuttle-chance | see-chance | see-chance-adjacent
| see-chance-at | speed-occupant-effect | spy-quality
| stack-protection
| surrender-chance | surrender-chance-per-attack
| surrender-range | tech-crossover | tech-per-research
| temperature-protection | tp-attrition | tp-crossover
| tp-max | tp-per-toolup | tp-to-build
| unit-capacity-x | unit-size-as-occupant
| withdraw-chance-per-attack
| zoc-range | zz-basic-capture-worth | zz-basic-hit-worth
| zz-basic-transport-worth
ut-table-name ::=
accident-damage | accident-hit-chance | accident-vanish-chance
| acp-night-effect | acp-to-add-terrain | acp-to-remove-terrain
| alter-terrain-range | altitude-max | altitude-min
| attack-terrain-effect | attrition | defend-terrain-effect
| detonation-accident-chance
| detonation-terrain-damage-chance | detonation-terrain-range
| eye-height | favored-terrain | independent-density
| mp-to-enter-terrain | mp-to-leave-terrain | mp-to-traverse
| people-surrender-chance | productivity | terrain-capacity-x
| unit-size-in-terrain | vanishes-on | visibility
| vision-night-effect | wrecks-on | zoc-from-terrain-effect
| zoc-into-terrain
um-table-name ::=
acp-to-load | acp-to-produce | acp-to-unload
| base-consumption | base-production | consumption-as-occupant
| consumption-on-creation
| consumption-per-attack | consumption-per-build
| consumption-per-move | consumption-per-repair | hit-by
| hp-per-starve | in-length | load-max
| material-per-production | material-to-act | material-to-build
| material-to-change-type | material-to-create
| material-to-fight
| material-to-move | material-to-produce | material-to-repair
| occupant-base-production | out-length | people-see-chance
| people-surrender-effect | productivity-max | productivity-min
| recycleable-material
| supply-on-completion | supply-on-creation
| supply-per-disband | unit-initial-supply | unit-storage-x
| unload-max
tt-table-name ::=
adjacent-terrain-effect
| coating-depth-max | coating-depth-min
| drawable-terrain | road-into-chance | terrain-damaged-type
tm-table-name ::=
change-on-exhaustion-chance | consumption-per-add-terrain
| material-per-remove-terrain | see-material-always
| terrain-consumption | terrain-exhaustion-type
| terrain-initial-supply | terrain-production
| terrain-storage-x
mm-table-name ::= people-consumption | people-production
add-form ::= ( add type-or-types property-name value )
imf-form ::= ( imf string [ imf-property-binding ]* [ image ]* )
imf-property-binding ::= ...
image ::= ( ( w h [ tile ] ) [ image-property-binding ]*
[ subimage * ] )
image-property-binding ::= ( image-property-name value )
image-property-name ::= actual | embed | embed-at | palette | pixel-size
| row-bytes
subimage ::= ( subimage-type string * )
subimage-type ::= color | mono | mask
palette-form ::= ( palette ... )
color-form ::= ( color string r g b )
type-or-types ::= type | symbol | ( [ type | symbol ]* )
value ::=
number
| symbol
| global-variable
| predefined-symbols
| ( [ value ]* )
| ( operation-name [ value ]* )
operation-name ::=
quote | list | append | remove | /= | < | <= | = | > | >=
global-constant ::=
true | false
| u* | t* | m*
| non-unit | non-terrain | non-material
| border | cell | coating | connection
| over-all | over-border | over-nothing | over-own
| no-x | river-x | road-x | valley-x
global-variable ::=
action-messages | advantage-default | advantage-max
| advantage-min | alt-blob-density | alt-blob-height
| alt-blob-size | alt-smoothing | calendar
| country-radius-max | country-radius-min
| country-separation-max
| country-separation-min | edge-terrain | elapsed-real-time
| event-messages | extra-turn-chance | feature-namers
| feature-types | grid-color | growth-stop-chance
| initial-date | initial-day-part | initial-year-part
| last-turn | maze-passage-density | maze-room-density
| player-sides-locked | random-events | random-state
| real-time-for-game | real-time-per-side | real-time-per-turn
| river-sink-terrain | scorefile-name | season-names
| see-all | see-terrain-always | see-weather-always
| self-required | side-library | sides-max
| sides-min | synthesis-methods | temperature-floor
| temperature-floor-elevation | temperature-moderation-range
| temperature-year-cycle
| terrain-seen | turn | units-in-game-max
| units-per-side-max | unseen-char | unseen-color
| unseen-image-name | use-side-priority | wet-blob-density
| wet-blob-height | wet-blob-size | wet-smoothing
| wind-mix-range
synthesis-methods ::=
make-countries | make-earthlike-terrain
| make-fractal-percentile-terrain | make-independent-units
| make-initial-materials | make-maze-terrain
| make-random-date | make-random-terrain | make-rivers
| make-roads | make-weather | name-geographical-features
| name-units-randomly
random-event-method ::=
accidents-in-terrain | attrition-in-terrain
| units-revolt | unit-surrender