Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: projects / text-adventure /

definition.mdwn

This page is a specification of the text adventure game file syntax.

At least for now, to make things clear and avoid confusion with HERITAGE files, the syntax defined here is called “Text Adventure Game Definition”, or TAGD. Files should generally have a .tagd extension, and are called “TAGD files” or “TAGD documents”.

Grammar Notation

See [[/grammar-notation]].

Encoding

The latest Unicode version at the time of writing is 7, and that is the version assumed for TAGD.

TAGD files must be encoded in UTF-8.

Linefeed must be used for line endings (the convention in GNU/Linux and other unix-based platforms).

Resources

Context-Free Grammar (for parser)

[[!format sgn """

= blankline* ( blankline) = | | | | | |

= actionstart nl

"""]]

Lexical Structure (for lexer)

The lexical structure defines how characters can be combined into lexemes by matching regular expressions. The lexemes are the alphabet for the grammar itself.

This project is the first time [[fr33domlover]] is trying to use incremental context-based lexical analysis. It means there are several token groups, not just one general top-level “lexeme” rule, and each group belongs to some context. Some rules can move the parser from one context to another.

[[!format sgn """

nl = / linefeed / linespacechar = / Unicode char with General Category “space”, or 9 tab / blankline = linespacechar* nl

l10naction = / Localized (translated) string, default “action” / l10nexit = / Localized (translated) string, default “exit” / l10ninfo = / Localized (translated) string, default “info” / l10nimport = / Localized (translated) string, default “import” / l10nitem = / Localized (translated) string, default “item” / l10nroom = / Localized (translated) string, default “room” / l10nvar = / Localized (translated) string, default “var” /

startaltsep = linespacechar* “|” linespacechar startidsep = linespacechar “.” linespacechar*

actionfirst = / Unicode letter / actionchar = / Unicode letter, digit or underscore / actionlast = / Unicode letter or digit / actionname = actionfirst (actionchar* actionlast)? actionstart = l10naction “(” actionname (startaltsep actionname)* “):”

exitfirst = / Unicode letter / exitchar = / Unicode letter, digit or underscore / exitlast = / Unicode letter or digit / exitname = exitfirst (exitchar* exitlast)? exitid = exitlast+ exitstart = l10exit “(” (exitname (startaltsep exitname)* startidsep)? exitid “):”

infostart = l10ninfo “():”

gamefilechar = / Unicode graphical char, i.e. isPrint, except for ) and / gamefile = gamefilechar+ (“/” gamefilechar+)? importstart = l10nimport “(” gamefile “)”

itemfirst = / Unicode letter / itemchar = / Unicode letter, digit or underscore / itemlast = / Unicode letter or digit / itemname = itemfirst (itemchar* itemlast)? itemid = itemlast+ itemstart = l10item “(” itemname (startaltsep itemname)* (startidsep itemid)? “):”

roomfirst = / Unicode letter / roomchar = / Unicode letter, digit or underscore / roomlast = / Unicode letter or digit / roomname = roomfirst (roomchar* roomlast)? roomcoord = (“+” | “-”)? [0-9]+ roomloc = roomcoord “.” roomcoord startidsep roomcoord roomstart = l10room “(” (roomloc|roomname) (startaltsep roomname)* “):”

varfirst = / Unicode letter or underscore / varchar = / Unicode letter, digit or underscore / varname = varfirst varchar* - / case-insensitive true|false|yes|no / newvarfirst = / Unicode letter / newvarname = newvarfirst varchar* - /case-insensitive true|false|yes|no / varvalue = valuebool | valuenum | value1string | value3string | valuevar valuebool = / case-insensitive true|false|yes|no, possibly localized / valuenum = (“+” | “-”)? [0-9]+ value1string = ‘“’ str1part* ’”’ value3string = ’""“’ str3part* ’”"“’ strchar = / graphical (isPrint) / str1part = strchar - ‘“’ str3part = strchar+ | ’”’ strchar+ | ’”“’ strchar+ valuevar = varname varsep = linespacechar*”," linespacechar* varstart = l10nvar “(” newvarname varsep varvalue “)”

templchar = / Unicode char that isn’t ‘’ / –templlast = templatechar - linespacechar –templtextpart = templchar - [@#$!]

templcalcsym = “@” templchangesym = “#” templcondsym = “$” templechosym = “!” templpareno = “(” templparenc = “)”

templcalcopen = templcalcsym templpareno templchangeopen = templchangesym templpareno templcondopen = templcondsym templpareno templechoopen = templechosym templpareno

templcalcclose = templparenc templcalcsym templcalcvar = varname templcalcop = [+-*/%] templcalcval = [0-9]+ templcalcnesto = “(” templcalcnestc = “)”

templchangeclose = templparenc templchangesym templchangevar = varname templchangeop = [+-*/%] templchangeval = [0-9]+

templcondnot = “!” templcondeq = “equals” –localized templcondgt = “more_than” –localized templcondlt = “less_than” –localized templcondloc = “require_location” –localized templcondhere = “require_here” –localized templcondinv = “require_inventory” –localized

templcondclose = templparenc templcondsym templcondsep = “:” templcondend = “;” templparamsep = “,” templcondelse = “|”

templechoclose = templparenc templechosym

"""]]

[See repo JSON]