Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Igor Grammar

dhemery edited this page Apr 8, 2012 · 13 revisions

This is the formal (EBNF) grammar for the Igor Query Language, with railroad diagrams.

IgorQuery
	= [ [ RelationshipPattern Combinator ] '$' ] RelationshipPattern
	;

RelationshipPattern
	= { SubjectPattern Combinator } SubjectPattern
	;

SubjectPattern
	= InstancePattern
	| BranchPattern
	;

BranchPattern
	= '(' RelationshipPattern ')'
	;

Combinator
	= whitespace
	| '>'
	| '~'
	;

InstancePattern
	= ( ClassPattern | IdentifierPattern | PositionPattern | PredicatePattern )
	  { IdentifierPattern | PositionPattern | PredicatePattern }
	;

ClassPattern
	= name
	| name '*'
	| '*'
	;

IdentifierPattern
	= '#' Identifier
	;

PositionPattern
	= ':' position
	;

PredicatePattern
	= '[' predicate ']'
	;

Identifier
	= integer
	| string
	| word
	;

Igor Query

Relationship Pattern

Subject Pattern

Branch Pattern

Combinator

Instance Pattern

Class Pattern

Identifier Pattern

Position Pattern

Predicate Pattern

Clone this wiki locally