Skip to main content
Department of Information Technology

GBT - Language Reference

Below is the grammar of the input language of GBT. This is the language used in .grm files given to the tool. Non-terminals are linked to their respective production rule.


grm_file : 'grammar' str '{' initial rulesdef bad invalid '}'

str : IDENTIFIER | LITERAL | NUMBER

initial : 'initial' graphfile

rulesdef : 'rules' rules

bad : 'bad' patternfiles

invalid : 'invalid' patternfiles

graphfile : str

rules : /* empty */ | rule | rules

patternfiles : /* empty */ | patternfile | patternfiles

rule : str patternfile '->' graphfile

patternfile : str


An IDENTIFIER is any string of alphabetic characters, underscores, digits, or periods, beginning with an alphabetic character.

A LITERAL is any double-quoted string ("..."), not containing quotes.

A NUMBER is any string of digits.


graphfile and patternfile are names of .dot files describing hypergraphs and (abstract) patterns respectively. The left hand sides of actions are (abstract) patterns and the right hand sides are hypergraphs. The node identifiers (attribute label) are used to determine the mapping between left and right hand sides of an action.

The .dot files must reside in the same folder as the .grm file. They are written in a subset of the dot language, with the production rules for graph, stmt, edge_stmt, edgeRHS, and node_stmt changed as follows:

graph : graph ID '{' stmt_list '}'

stmt : node_stmt | edge_stmt | ID '=' ID

edge_stmt : ID edgeRHS

edgeRHS : ID '--' ID attr_list [ edgeRHS ]

node_stmt : ID attr_list

Note: We interpret the dot node to the left of '--' in edgeRHS as the hyperedge. The dot node to the right of '--' in edgeRHS is interpreted as the node.

The following attribute settings have a special meaning to GBT:

Attribute setting Meaning
shape = box Generates a positive hyperedge
shape = circle Generates a positive node
shape = Mcircle Generates a summary node

- used to summarize nodes with the same specified node type (abstraction module)
shape = doublecircle Generates a negative node (for use in NACs)
shape = doubleoctagon Generates a negative hyperedge (for use in NACs)
shape = diamond Generates a positive multiplier node

- used together with attribute match to multiply graphs/patterns/actions with different node configurations
label = str Used to label nodes and hyperedges
type = str Used for simple labeling of nodes; the label will be part of the node type. Matches any label if not given or given as the empty string. If two nodes have non-empty strings as their node labels, then these strings must be equal in order for the labels to match.
match = LITERAL Has a meaning only when used in an attr_list together with shape = diamond

- expects a LITERAL with a comma-separated list of N node identifiers; multiplies the graph/pattern/action N times and sets the label of the node to a new identifier in the given list, for each of the N graphs/patterns/actions

All other attributes and attribute settings are ignored by GBT and can be used to improve the visual appearance of the model, when generating model images with, e.g., Graphviz tools.

Updated  2016-08-17 15:26:29 by Björn Victor.