OpenVADL (v0.2.0-847-gc682f9dc3)
Loading...
Searching...
No Matches
vadl.ATG File Reference

Grammar characters

 digit
 binDigit
 hexDigit
 letter
 validDQStringCharacters
 validSQStringCharacters
 validSourceCharacters

Grammar tokens

 binLit
 hexLit
 decLit
 embeddedSource
 identifierToken
 string
 T_BIN
 T_BIN_OP
 T_BOOL
 T_CALL_EX
 T_COMMON_DEFS
 T_ENCS
 T_EX
 T_ID
 T_INT
 T_ISA_DEFS
 T_LIT
 T_STAT
 T_STATS
 T_STR
 T_SYM_EX
 T_UN_OP
 T_VAL
 ABSOLUTE
 ADDRESS
 ADJUSTMENT
 ALIAS
 ALIGN
 APPEND
 APPLICATION
 ARCHITECTURE
 ARGUMENT
 ASSEMBLY
 BINARY
 CACHE
 CALL
 CALLEE
 CALLER
 COMPILER_KW
 CONSTANT
 COUNTER
 DECODER
 DESCRIPTION
 DIRECTIVES
 DO
 ELSE
 ENCODING
 ENUMERATION
 EXCEPTION
 EXISTS
 AS_ID
 EXTENDING
 FALSE
 FETCH
 FILE
 FOLD
 FOR
 FORALL
 FORMAT
 FRAME
 FUNCTION
 GLOBAL
 GRAMMAR
 GROUP
 HIT
 AS_STR
 IF_KW
 INT
 IMPLEMENTS
 IMPORT
 INSTRUCTION
 INTERFACE
 LET
 LOAD
 LOCAL
 LOCK
 LOGIC
 LONG
 MATCH
 MAX
 MEMORY
 MICRO
 MISS
 MODEL
 MODEL_TYPE
 MODIFIERS
 NON
 NONE
 NOP
 OPERATION
 PATCH
 PIC
 PIPELINE
 POINTER
 PREDICTION
 PROCESS
 PROCESSOR
 PROGRAM
 PSEUDO
 RAISE
 RAM
 READ
 RECORD
 REGISTER
 REGION
 RELOCATION
 RESET
 RETURN
 ROM
 SAVED
 SEQUENCE
 SET
 SIGNAL
 SIGNED
 SIZE_T
 SPECIAL
 SOURCE
 STACK
 STAGE
 STARTUP
 STOP
 TENSOR
 THEN
 THREAD
 TRANSLATION
 TRUE
 TYPE
 UNSIGNED
 USING
 VALUE
 VAR
 WIDTH
 WITH
 WRITE
 SYM_ARROW
 SYM_AS
 SYM_ASSIGN
 SYM_AT
 SYM_BIGARROW
 SYM_BINAND
 SYM_BINOR
 SYM_BRACE_CLOSE
 SYM_BRACE_OPEN
 SYM_BRACK_CLOSE
 SYM_BRACK_OPEN
 SYM_CARET
 SYM_COLON
 SYM_COMMA
 SYM_DIV
 SYM_DOLLAR
 SYM_DOT
 SYM_ELEM_OF
 SYM_EQ
 SYM_EXCL
 SYM_GT
 SYM_GTE
 SYM_IN
 SYM_LOGAND
 SYM_LOGOR
 SYM_LONG_MUL
 SYM_LT
 SYM_LTE
 SYM_MINUS
 SYM_MOD
 SYM_MUL
 SYM_NAMESPACE
 SYM_NEQ
 SYM_NIN
 SYM_NOT_ELEM_OF
 SYM_PAREN_CLOSE
 SYM_PAREN_OPEN
 SYM_PREDICATE
 SYM_PLUS
 SYM_PLUS_EQ
 SYM_QUESTION
 SYM_RANGE
 SYM_ROTL
 SYM_ROTR
 SYM_SAT_ADD
 SYM_SAT_SUB
 SYM_SEMICOLON
 SYM_SHL
 SYM_SHR
 SYM_TILDE
 SYM_UNDERSCORE

Grammar productions

 vadl
 topLevelDefinition
 commonDefinitionList
 commonDefinition
 instructionsetDefinition
 isaDefinitionList
 annotations
 annotation
 isaDefinition
 constantDefinition
 formatDefinition
 formatField
 auxiliaryField
 formatFieldRange
 formatFieldType
 formatFieldDerived
 counterDefinition
 instructionDefinition
 pseudoInstructionDefinition
 relocationDefinition
 identifierOrPlaceholder
 encodingDefinition
 encodingDefinitionList
 encodingEntry
 assemblyDefinition
 stringLiteral
 memoryDefinition
 registerDefinition
 relationType
 aliasDefinition
 usingDefinition
 functionDefinition
 parameters
 parameter
 enumerationDefinition
 exceptionDefinition
 recordDefinition
 modelTypeDefinition
 importDefinition
 processDefinition
 processTemplateParameters
 operationDefinition
 groupDefinition
 groupSequence
 group
 groupLiteral
 groupAlternative
 groupPermutation
 applicationBinaryInterfaceDefinition
 abiElementDefinition
 clangTypeDefinition
 clangNumericTypeDefinition
 typeSizeDefinition
 specialPurposeRegisterSingleDef
 abiSpecialPurposeInstructionDefinition
 abiSequenceDef
 processorDefinition
 cpuDefinition
 memoryRegionDefinition
 patchDefinition
 sourceDefinition
 sourceLiteral
 cpuFunctionDefinition
 cpuProcessDefinition
 microArchitectureDefinition
 miaDefinition
 pipelineDefinition
 stageoutput
 stageoutputs
 stageDefinition
 cacheDefinition
 logicDefinition
 resourceReference
 assemblyDescriptionDefinition
 assemblyCommonDefinition
 assemblyModifiersDefinition
 assemblyModifierDefinition
 assemblyDirectivesDefinition
 assemblyDirectiveDefinition
 assemblyGrammarDefinition
 assemblyGrammarRuleDefinition
 assemblyGrammarTypeDefinition
 assemblyGrammarAlternatives
 assemblyGrammarElements
 assemblyGrammarElement
 assemblyLocalVarDeclaration
 assemblyGrammarLiteral
 assemblyParameterList
 assemblyGrammarGroup
 assemblyGrammarOptional
 assemblyGrammarRepetition
 statement
 blockStatement
 statementList
 assignmentOrCallStmt
 instructionCallStmt
 letStatement
 ifStatement
 raiseStatement
 matchStatement
 lockStatement
 forallStatement
 expression
 callOrBinaryExpression
 arguments
 argument
 symbolOrBinaryExpression
 binaryOperator
 unary
 unaryOperator
 term
 groupedExpression
 literal
 valLiteral
 intLiteral
 binLiteral
 boolLiteral
 referenceLiteral
 identifierPath
 rangeExpression
 letExpression
 ifExpression
 matchExpression
 existsExpression
 operationsList
 forallExpression
 typeLiteral
 identifier
 allowedIdentifierKeywords
 assemblyIdentifier
 assemblyAllowedIdentifierKeywords
 sequenceCallExprList
 sequenceCallExpr
 macroReplacement
 AsId
 AsStr
 macroMatch
 maximumMacroExpr
 macroDefinition
 macroBody
 unreachableRule
 syntaxType
 projectionType
 basicSyntaxType

Declarations

COMMENTS FROM "//" TO '\n'
COMMENTS FROM "/*" TO "*/" NESTED
IGNORE '\t' + '\r' + '\n'

Grammar Character Documentation

Further CHARACTERS

digit = '0' .. '9'.
binDigit = '0' .. '1'.
hexDigit = '0' .. '9' + 'A' .. 'F' + 'a' .. 'f'.
letter = 'a' .. 'z' + 'A' .. 'Z'.
validDQStringCharacters = ANY - '"' - "\\".
validSQStringCharacters = ANY - "'" - "\\".

Grammar Token Documentation

◆ T_BIN

The T_BIN token is used as the name of the syntax type for a binary or hexadecimal literal like '0b10101010' or '0x1234abcd' (binLit or hexLit, see type hierarchy syntax_type_hierarchy).

T_BIN = "Bin".

T_BIN is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_BIN_OP

The T_BIN_OP token is used as the name of the syntax type for binary operators like '+' or '*' (see type hierarchy syntax_type_hierarchy).

T_BIN_OP = "BinOp".

T_BIN_OP is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_BOOL

The T_BOOL token is used as the name of the syntax type for the boolean literals 'true' and 'false' (see type hierarchy syntax_type_hierarchy).

T_BOOL = "Bool".

#T_BT_BOOLIN is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_CALL_EX

The T_CALL_EX token is used as the name of the syntax type for a call expression (see type hierarchy syntax_type_hierarchy).

T_CALL_EX = "CallEx".

T_CALL_EX is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_COMMON_DEFS

The T_COMMON_DEFS token is used as the name of the syntax type for one or more common definitions like constants, formations or functions (see type hierarchy syntax_type_hierarchy).

T_COMMON_DEFS = "Defs".

T_COMMON_DEFS is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_ENCS

The T_ENCS token is used as the name of the syntax type for oner or more instruction encodings (see type hierarchy syntax_type_hierarchy).

T_ENCS = "Encs".

T_ENCS is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_EX

The T_EX token is used as the name of the syntax type for a general expression (see type hierarchy syntax_type_hierarchy).

T_EX = "Ex".

T_EX is referenced by basicSyntaxType.

◆ T_ID

The T_ID token is used as the name of the syntax type for an identifier (see type hierarchy syntax_type_hierarchy).

T_ID = "Id".

T_ID is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_INT

The T_INT token is used as the name of the syntax type for a decimal integer literal like '123' (see type hierarchy syntax_type_hierarchy).

T_INT = "Int".

T_INT is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_ISA_DEFS

The T_ISA_DEFS token is used as the name of the syntax type of one or more definitions inside the ISA section (see type hierarchy syntax_type_hierarchy).

T_ISA_DEFS = "IsaDefs".

T_ISA_DEFS is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_LIT

The T_LIT token is used as the name of the syntax type for a literal of any type (see type hierarchy syntax_type_hierarchy).

T_LIT = "Lit".

T_LIT is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_STAT

The T_STAT token is used as the name of the syntax type for a single statement (see type hierarchy syntax_type_hierarchy).

T_STAT = "Stat".

T_STAT is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_STATS

The T_STATS token is used as the name of the syntax type for one or more statements (see type hierarchy syntax_type_hierarchy).

T_STATS = "Stats".

T_STATS is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_STR

The T_STR token is used as the name of the syntax type for a string literal like 'abc' or "abc" (string, see type hierarchy #syntax_type_hierarchy).

T_STR = "Str".

T_STR is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_SYM_EX

The T_SYM_EX token is used as the name of the syntax type for a symbol expression (see type hierarchy syntax_type_hierarchy).

T_SYM_EX = "SymEx".

T_SYM_EX is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_UN_OP

The T_UN_OP token is used as the name of the syntax type for unary operators like '+' or '!' (see type hierarchy syntax_type_hierarchy).

T_UN_OP = "UnOp".

T_UN_OP is referenced by allowedIdentifierKeywords, basicSyntaxType.

◆ T_VAL

The T_VAL token is used as the name of the syntax type for a value literal (see type hierarchy syntax_type_hierarchy).

T_VAL = "Val".

T_VAL is referenced by allowedIdentifierKeywords, basicSyntaxType.

Further TOKENS

binLit = "0b" binDigit {binDigit | "'"}.
hexLit = "0x" hexDigit {hexDigit | "'"}.
decLit = digit {digit | "'"}.
( '"' { "\\" (letter | '"' | "'" | "\\") | validDQStringCharacters } '"') |
( "'" { "\\" (letter | '"' | "'" | "\\") | validSQStringCharacters } "'").
ABSOLUTE = "absolute".
ADDRESS = "address".
ADJUSTMENT = "adjustment".
ALIAS = "alias".
ALIGN = "align".
APPEND = "append".
APPLICATION = "application".
ARCHITECTURE = "architecture".
ARGUMENT = "argument".
ASSEMBLY = "assembly".
BINARY = "binary".
CACHE = "cache".
CALL = "call".
CALLEE = "callee".
CALLER = "caller".
COMPILER_KW = "compiler".
CONSTANT = "constant".
COUNTER = "counter".
DECODER = "decoder".
DESCRIPTION = "description".
DIRECTIVES = "directives".
DO = "do".
ELSE = "else".
ENCODING = "encoding".
ENUMERATION = "enumeration".
EXCEPTION = "exception".
EXISTS = "exists".
AS_ID = "AsId".
EXTENDING = "extending".
FALSE = "false".
FETCH = "fetch".
FILE = "file".
FOLD = "fold".
FOR = "for".
FORALL = "forall".
FORMAT = "format".
FRAME = "frame".
FUNCTION = "function".
GLOBAL = "global".
GRAMMAR = "grammar".
GROUP = "group".
HIT = "hit".
AS_STR = "AsStr".
IF_KW = "if".
INT = "int".
IMPLEMENTS = "implements".
IMPORT = "import".
INSTRUCTION = "instruction".
INTERFACE = "interface".
LET = "let".
LOAD = "load".
LOCAL = "local".
LOCK = "lock".
LOGIC = "logic".
LONG = "long".
MATCH = "match".
MAX = "max".
MEMORY = "memory".
MICRO = "micro".
MISS = "miss".
MODEL = "model".
MODEL_TYPE = "model-type".
MODIFIERS = "modifiers".
NON = "non".
NONE = "none".
NOP = "nop".
OPERATION = "operation".
PATCH = "patch".
PIC = "pic".
PIPELINE = "pipeline".
POINTER = "pointer".
PREDICTION = "prediction".
PROCESS = "process".
PROCESSOR = "processor".
PROGRAM = "program".
PSEUDO = "pseudo".
RAISE = "raise".
RAM = "RAM".
READ = "read".
RECORD = "record".
REGISTER = "register".
REGION = "region".
RELOCATION = "relocation".
RESET = "reset".
RETURN = "return".
ROM = "ROM".
SAVED = "saved".
SEQUENCE = "sequence".
SET = "set".
SIGNAL = "signal".
SIGNED = "signed".
SIZE_T = "size_t".
SPECIAL = "special".
SOURCE = "source".
STACK = "stack".
STAGE = "stage".
STARTUP = "startup".
STOP = "stop".
TENSOR = "tensor".
THEN = "then".
THREAD = "thread".
TRANSLATION = "translation".
TRUE = "true".
TYPE = "type".
UNSIGNED = "unsigned".
USING = "using".
VALUE = "value".
VAR = "var".
WIDTH = "width".
WITH = "with".
WRITE = "write".
SYM_ARROW = "->".
SYM_AS = "as".
SYM_ASSIGN = ":=".
SYM_AT = "@".
SYM_BIGARROW = "=>".
SYM_BINAND = "&".
SYM_BINOR = "|".
SYM_CARET = "^".
SYM_COLON = ":".
SYM_COMMA = ",".
SYM_DIV = "/".
SYM_DOLLAR = "$".
SYM_DOT = ".".
SYM_ELEM_OF = "∈".
SYM_EQ = "=".
SYM_EXCL = "!".
SYM_GT = ">".
SYM_GTE = ">=".
SYM_IN = "in".
SYM_LOGAND = "&&".
SYM_LOGOR = "||".
SYM_LONG_MUL = "*#".
SYM_LT = "<".
SYM_LTE = "<=".
SYM_MINUS = "-".
SYM_MOD = "%".
SYM_MUL = "*".
SYM_NEQ = "!=".
SYM_NIN = "!in".
SYM_PLUS = "+".
SYM_PLUS_EQ = "+=".
SYM_RANGE = "..".
SYM_ROTL = "<<>".
SYM_ROTR = "<>>".
SYM_SAT_ADD = "+|".
SYM_SAT_SUB = "-|".
SYM_SHL = "<<".
SYM_SHR = ">>".
SYM_TILDE = "~".

Grammar Production Documentation

◆ vadl

The vadl production rule is the entry point of a VADL processor specification as well as of the OpenVADL parser.

= {
topLevelDefinition<out Definition def>
| macroDefinition<out ModelDefinition def>
}.

A VADL specification consists of multiple topLevelDefinition elements like a type alias (usingDefinition) or a function definition (functionDefinition) and sections like the ISA section (instructionsetDefinition). It is also possible to define macros (macroDefinition).

◆ topLevelDefinition

The topLevelDefinition production rule lists (beside macro definitions) all VADL language elements allowed on the top level of a VADL specification.

topLevelDefinition<out Definition def>
= annotations<out List<AnnotationDefinition> annotations>
| commonDefinition<out def>
| importDefinition<out def>
)
.
Listing: Top level definitions with some common definitions
constant MLen = 64
using SIntM = SInt<MLen>
function lessthan (a: SIntM, b: SIntM) -> Bool = a < b
import rv3264im::RV3264Base with ("ArchSize=Arch64")
instruction set architecture RV64IM extending RV3264Base = {}
application binary interface ABI for RV64IM = {}
assembly description Assemble for ABI = {}
micro architecture FiveStage implements RV64IM = {}
[ htif ]
processor CPU implements RV64IM with ABI = {}


Listing lst_top_level_definitions gives examples for top level language elements. Annotations (annotations) can be added to most VADL language elements. The htif annotation in line 11 is an annotation for the processor definition (processorDefinition) in line 12. A constant definition (line 1), a using definition (line 2) or a function definition (line 3) are examples for common definitions (commonDefinition). An instruction set architecture definition (instructionsetDefinition) is shown in line 7. An application binary interface definition (applicationBinaryInterfaceDefinition) is shown in line 8. An assembly description (assemblyDescriptionDefinition) is shown in line 9. A micro architecture definition (microArchitectureDefinition) is shown in line 10.

topLevelDefinition is referenced by vadl.

◆ commonDefinitionList

The commonDefinitionList production rule lists (beside macro definitions) all common definition with annotations.

commonDefinitionList<out List<Definition> definitions>
= {
annotations<out List<AnnotationDefinition> annotations>
commonDefinition<out Definition def>
| macroDefinition<out ModelDefinition def>
| macroReplacement<out Node n>
}
.

commonDefinitionList is referenced by macroBody.

◆ commonDefinition

commonDefinition<out Definition def>
= constantDefinition<out def>
| formatDefinition<out def>
| usingDefinition<out def>
| functionDefinition<out def>
| recordDefinition<out def>
.

◆ instructionsetDefinition

instructionsetDefinition<out InstructionSetDefinition isaDef>
identifierOrPlaceholder<out var identifier>
[
{
}
]
isaDefinitionList<out List<Definition> definitions>
.

◆ isaDefinitionList

isaDefinitionList<out List<Definition> definitions>
= {
annotations<out List<AnnotationDefinition> annotations>
isaDefinition<out Definition def>
| macroDefinition<out ModelDefinition def>
| macroReplacement<out Node n>
}
.

◆ annotations

Multiple annotations (annotations) can by declared in front of many syntactic elements. A single annotation is described in the annotation production rule.

annotations<out List<AnnotationDefinition> annotations>
= {
annotation<out AnnotationDefinition annotation>
}
.

annotations is used by abiElementDefinition, commonDefinitionList, cpuDefinition, isaDefinitionList, miaDefinition, topLevelDefinition.

◆ annotation

annotation<out AnnotationDefinition annotation>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
{
identifierOrPlaceholder<out IdentifierOrPlaceholder id2>
}
[
expression<out Expr expr, BIN_OPS>
{
expression<out Expr expr2, BIN_OPS>
}
]
.

◆ isaDefinition

isaDefinition<out Definition def>
= commonDefinition<out def>
| IF (la.kind == _GROUP && scanner.Peek().kind != _COUNTER)
groupDefinition<out def>
| counterDefinition<out def>
| encodingDefinition<out def>
| assemblyDefinition<out def>
| memoryDefinition<out def>
| registerDefinition<out def>
| aliasDefinition<out def>
| processDefinition<out def>
.

◆ constantDefinition

constantDefinition<out ConstantDefinition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
[ SYM_COLON typeLiteral<out type> ]
expression<out Expr expr, BIN_OPS>
.

◆ formatDefinition

formatDefinition<out FormatDefinition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
SYM_COLON typeLiteral<out TypeLiteral type>
[
formatField<out FormatField f1>
( IF (la.kind == _identifierToken && ( peek == _SYM_ASSIGN || peek == _SYM_PREDICATE ))
auxiliaryField<out FormatDefinition.AuxiliaryField aux>
| formatField<out FormatField f2>
)
}
]
.

◆ formatField

formatField<out FormatField field>
= identifier<out Identifier id>
( formatFieldRange<out field, id>
| formatFieldType<out field, id>
| formatFieldDerived<out field, id>
)
.

◆ auxiliaryField

auxiliaryField<out FormatDefinition.AuxiliaryField auxField>
= identifier<out Identifier id>
)
expression<out Expr expr, BIN_OPS>
.

◆ formatFieldRange

formatFieldRange<out FormatField field, Identifier id>
rangeExpression<out Expr e1>
{
rangeExpression<out Expr e2>
}
[
typeLiteral<out type>
]
.

◆ formatFieldType

formatFieldType<out FormatField field, Identifier id>
typeLiteral<out TypeLiteral type>
.

◆ formatFieldDerived

formatFieldDerived<out FormatField field, Identifier id>
expression<out Expr expr, BIN_OPS>
.

◆ counterDefinition

counterDefinition<out CounterDefinition def>
= ( PROGRAM
| GROUP
)
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
SYM_COLON typeLiteral<out TypeLiteral type>
.

◆ instructionDefinition

instructionDefinition<out InstructionDefinition def>
= INSTRUCTION identifierOrPlaceholder<out IdentifierOrPlaceholder id>
SYM_COLON identifierOrPlaceholder<out IdentifierOrPlaceholder formatId>
SYM_EQ statement<out Statement behavior>
.

◆ pseudoInstructionDefinition

pseudoInstructionDefinition<out Definition def>
= ( PSEUDO
)
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
[ parameters<out params> ]
{
instructionCallStmt<out InstructionCallStatement stmt>
}
.

◆ relocationDefinition

relocationDefinition<out Definition def>
identifier<out Identifier id>
parameters<out List<Parameter> params>
typeLiteral<out TypeLiteral resultType>
expression<out Expr expr, BIN_OPS>
.

◆ identifierOrPlaceholder

identifierOrPlaceholder<out IdentifierOrPlaceholder id>
= identifier<out id>
| macroReplacement<out Node node>
.

◆ encodingDefinition

encodingDefinition<out EncodingDefinition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder instrId>
encodingDefinitionList<out EncodingDefinition.EncsNode encodings>
.

◆ encodingDefinitionList

encodingDefinitionList<out EncodingDefinition.EncsNode encs>
= encodingEntry<out IsEncs enc>
{
IF (la.kind == _SYM_COMMA)
encodingEntry<out enc>
}
.

◆ encodingEntry

encodingEntry<out IsEncs enc>
= IF (la.kind == _NONE)
| macroReplacement<out Node node>
| identifier<out Identifier id>
expression<out Expr expr, BIN_OPS>
.

◆ assemblyDefinition

assemblyDefinition<out AssemblyDefinition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
{
identifierOrPlaceholder<out IdentifierOrPlaceholder additionalId>
}
expression<out Expr expr, BIN_OPS>
.

◆ stringLiteral

stringLiteral<out StringLiteral lit>
= string
.

◆ memoryDefinition

memoryDefinition<out MemoryDefinition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
SYM_COLON typeLiteral<out TypeLiteral t1>
SYM_ARROW typeLiteral<out TypeLiteral t2>
.

◆ registerDefinition

registerDefinition<out RegisterDefinition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
relationType<out RegisterDefinition.RelationTypeLiteral type>
.

◆ relationType

relationType<out RegisterDefinition.RelationTypeLiteral type>
= typeLiteral<out TypeLiteral t0>
[{
typeLiteral<out TypeLiteral argType>
}
typeLiteral<out TypeLiteral t1>
]
.

◆ aliasDefinition

aliasDefinition<out Definition def>
(
[
typeLiteral<out aliasType>
[
typeLiteral<out targetType>
]
]
[
typeLiteral<out aliasType>
]
)
callOrBinaryExpression<out Expr value, false, true>
.

◆ usingDefinition

usingDefinition<out Definition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
typeLiteral<out TypeLiteral type>
.

◆ functionDefinition

functionDefinition<out Definition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder name>
[ parameters<out params> ]
typeLiteral<out TypeLiteral retType>
expression<out Expr expr, BIN_OPS>
.

◆ parameters

parameters<out List<Parameter> params>
[
parameter<out Parameter param>
{
parameter<out Parameter next>
}
]
.

◆ parameter

parameter<out Parameter param>
= identifier<out Identifier name>
typeLiteral<out TypeLiteral type>
.

◆ enumerationDefinition

enumerationDefinition<out Definition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
[ SYM_COLON typeLiteral<out enumType> ]
identifier<out Identifier name>
[
expression<out value, BIN_OPS>
]
{
identifier<out name>
[
expression<out value, BIN_OPS>
]
}
.

◆ exceptionDefinition

exceptionDefinition<out Definition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
[ parameters<out params> ]
statement<out Statement statement>
.

◆ recordDefinition

recordDefinition<out RecordTypeDefinition def>
identifier<out Identifier recordName>
identifier<out Identifier paramName>
syntaxType<out SyntaxType type>
{
identifier<out paramName>
syntaxType<out type>
}
.

◆ modelTypeDefinition

modelTypeDefinition<out ModelTypeDefinition def>
identifier<out Identifier name>
projectionType<out ProjectionType type>
.

◆ importDefinition

importDefinition<out Definition def>
( identifier<out fileId>
| stringLiteral<out filePath>
)
{
IF (la.kind == _SYM_NAMESPACE && scanner.Peek().kind != _SYM_BRACE_OPEN)
identifier<out Identifier segment>
}
[
identifier<out Identifier symbol>
{
identifier<out symbol>
}
{
identifier<out symbol>
{
identifier<out symbol>
}
}
]
[
stringLiteral<out StringLiteral arg>
{
stringLiteral<out arg>
}
]
.

◆ processDefinition

processDefinition<out Definition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder name>
[ processTemplateParameters<out templateParams> ]
[ parameters<out inputs> ]
[ SYM_ARROW parameters<out outputs> ]
statement<out Statement stmt>
.

◆ processTemplateParameters

processTemplateParameters<out List<TemplateParam> templateParams>
= SYM_LT
identifier<out Identifier id>
typeLiteral<out TypeLiteral type>
[
expression<out value, BIN_OPS_EXCEPT_GT>
]
{
identifier<out id>
typeLiteral<out type>
[
expression<out value, BIN_OPS_EXCEPT_GT>
]
}
.

◆ operationDefinition

operationDefinition<out Definition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder name>
[
identifierPath<out IsId path>
{
identifierPath<out path>
}
]
.

◆ groupDefinition

groupDefinition<out Definition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
[
typeLiteral<out type>
]
groupSequence<out Group.Sequence seq>
.

◆ groupSequence

groupSequence<out Group.Sequence seq>
= group<out Group group>
{
group<out group>
}
.

◆ group

group<out Group group>
= groupLiteral<out group>
| groupAlternative<out group>
| groupPermutation<out group>
.

◆ groupLiteral

groupLiteral<out Group group>
= identifierPath<out IsId path>
[
expression<out size, BIN_OPS_EXCEPT_GT>
[
expression<out Expr rangeTo, BIN_OPS_EXCEPT_GT>
]
]
.

◆ groupAlternative

groupAlternative<out Group group>
groupSequence<out Group.Sequence seq>
{
groupSequence<out seq>
}
.

◆ groupPermutation

groupPermutation<out Group group>
groupSequence<out Group.Sequence seq>
{
groupSequence<out seq>
}
.

◆ applicationBinaryInterfaceDefinition

identifier<out Identifier id>
identifierPath<out IsId isaPath>
{
abiElementDefinition<out Definition elem>
}
.

◆ abiElementDefinition

abiElementDefinition<out Definition def>
= annotations<out List<AnnotationDefinition> annotations>
| aliasDefinition<out def>
| abiSequenceDef<out def>
)
| macroReplacement<out Node n>
.

◆ clangTypeDefinition

clangTypeDefinition<out Definition def>
=
(
SIZE_T TYPE SYM_EQ typeSizeDefinition<out AbiClangTypeDefinition.TypeSize size1>
| INT MAX TYPE SYM_EQ typeSizeDefinition<out AbiClangTypeDefinition.TypeSize size2>
)
.

◆ clangNumericTypeDefinition

clangNumericTypeDefinition<out Definition def>
=
(
| ALIGN
)
| LONG (
| ALIGN
)
)
SYM_EQ expression<out Expr expr, BIN_OPS>
.

◆ typeSizeDefinition

typeSizeDefinition<out AbiClangTypeDefinition.TypeSize def>
=
(
INT
| LONG
)
| SIGNED (
INT
| LONG
)
)
.

◆ specialPurposeRegisterSingleDef

specialPurposeRegisterSingleDef<out Definition def>
=
(
| VALUE
)
)
sequenceCallExprList<out List<ExpandedSequenceCallExpr> calls>
.

◆ abiSpecialPurposeInstructionDefinition

◆ abiSequenceDef

abiSequenceDef<out Definition def>
=
(
)
[ parameters<out params> ]
{
instructionCallStmt<out InstructionCallStatement stmt>
}
.

◆ processorDefinition

processorDefinition<out Definition def>
identifier<out Identifier id>
identifierPath<out IsId isa>
[
identifierPath<out IsId abiId>
]
{
cpuDefinition<out Definition cpuDef>
}
.

◆ cpuDefinition

cpuDefinition<out Definition def>
= annotations<out List<AnnotationDefinition> annotations>
( commonDefinition<out def>
| patchDefinition<out def>
| sourceDefinition<out def>
)
|
macroReplacement<out Node n>
.

◆ memoryRegionDefinition

memoryRegionDefinition<out Definition def>
=
( RAM
| ROM
)
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
SYM_IN identifierPath<out IsId mem>
[ SYM_EQ statement<out stmt> ]
.

◆ patchDefinition

patchDefinition<out Definition def>
identifier<out Identifier generator>
identifier<out Identifier handle>
( identifierPath<out reference>
| sourceLiteral<out source> )
.

◆ sourceDefinition

sourceDefinition<out Definition def>
identifier<out Identifier id>
sourceLiteral<out String source>
.

◆ sourceLiteral

sourceLiteral<out String source>
.

◆ cpuFunctionDefinition

cpuFunctionDefinition<out Definition def>
=
( STOP
[ WITH referenceLiteral<out stopWithRef> ]
)
expression<out Expr expr, BIN_OPS>
.

◆ cpuProcessDefinition

cpuProcessDefinition<out Definition def>
=
( RESET
parameters<out outputs> ]
)
statement<out Statement stmt>
.

◆ microArchitectureDefinition

The microArchitectureDefinition production rule starts the micro architecture section.

microArchitectureDefinition<out Definition def>
identifier<out Identifier id>
identifierPath<out IsId processor>
{
miaDefinition<out Definition child>
}
.

microArchitectureDefinition is referenced by topLevelDefinition.

◆ miaDefinition

The miaDefinition production rule lists all micro architecture language elements.

miaDefinition<out Definition def>
= annotations<out List<AnnotationDefinition> annotations>
( pipelineDefinition<out def>
| stageDefinition<out def>
| cacheDefinition<out def>
| logicDefinition<out def>
| memoryDefinition<out def>
| registerDefinition<out def>
| processDefinition<out def>
| commonDefinition<out def>
)
| macroReplacement<out Node n>
.
Listing: Example micro architecture definition
micro architecture FiveStage implements RV32IM = {
logic [forwarding] bypass
stage FETCH -> ( fr : FetchResult ) = {
fr := fetchNext // fetch next packet from memory (or cache)
}
stage DECODE -> ( ir : Instruction ) = {
let instr = decode( FETCH.fr ) in { // decode the fetch packet, gives an Instruction
if( instr.unknown ) then
raise invalidInstruction // raise an invalid instruction exception
instr.address( @X ) // output computed address (X + offset) to memory
instr.read( @X ) // read from the X register file
instr.read( @PC ) // read from the PC
ir := instr // stage output is the Instruction ir
}
}
stage EXECUTE -> ( ir : Instruction ) = {
let instr = DECODE.ir in {
instr.compute // evaluate all expressions
instr.verify // check and flush pipeline if branch misprediction
instr.write( @PC ) // write PC
ir := instr
}
}
stage MEMORY -> ( ir : Instruction ) = {
let instr = EXECUTE.ir in {
instr.write( @MEM ) // write to memory
instr.read( @MEM ) // receive data from memory read
ir := instr
}
}
stage WRITE_BACK = {
let instr = MEMORY.ir in
instr.write( @X ) // write back to register file X
}
}


Listing lst_mia_definitions gives examples for top level language elements. A micro architecture definition (microArchitectureDefinition) is shown in line 1.

miaDefinition is referenced by microArchitectureDefinition.

◆ pipelineDefinition

pipelineDefinition<out Definition def>
identifier<out Identifier id>
[ SYM_ARROW parameters<out outputs> ]
statement<out Statement stmt>
.

◆ stageoutput

stageoutput<out StageOutputDefinition output>
= identifier<out Identifier name>
typeLiteral<out TypeLiteral type>
.

◆ stageoutputs

stageoutputs<out List<StageOutputDefinition> outputs>
[
stageoutput<out StageOutputDefinition output>
{
stageoutput<out StageOutputDefinition next>
}
]
.

◆ stageDefinition

stageDefinition<out Definition def>
identifier<out Identifier id>
[ SYM_ARROW stageoutputs<out outputs> ]
statement<out Statement stmt>
.

◆ cacheDefinition

cacheDefinition<out Definition def>
identifier<out Identifier id>
typeLiteral<out TypeLiteral sourceType>
typeLiteral<out TypeLiteral targetType>
.

◆ logicDefinition

logicDefinition<out Definition def>
identifier<out Identifier id>
{
identifier<out id>
}
identifier<out id>
.

◆ resourceReference

resourceReference<out ResourceReferenceExression expr>
=
identifier<out var id>
.

◆ assemblyDescriptionDefinition

assemblyDescriptionDefinition<out AsmDescriptionDefinition asmDescription>
assemblyIdentifier<out Identifier id>
assemblyIdentifier<out Identifier abi>
{ assemblyModifiersDefinition<out modifiers>
| assemblyDirectivesDefinition<out directives>
| assemblyCommonDefinition<out Definition def>
}
.

◆ assemblyCommonDefinition

assemblyCommonDefinition<out Definition def>
= constantDefinition<out def>
| usingDefinition<out def>
| functionDefinition<out def>
.

◆ assemblyModifiersDefinition

assemblyModifiersDefinition<out List<AsmModifierDefinition> modifiers>
assemblyModifierDefinition<out AsmModifierDefinition first>
{ SYM_COMMA assemblyModifierDefinition<out AsmModifierDefinition other>
}
.

◆ assemblyModifierDefinition

assemblyModifierDefinition<out AsmModifierDefinition modifier>
= stringLiteral<out Expr strLit>
assemblyIdentifier<out Identifier isaId>
assemblyIdentifier<out Identifier modifierId>
.

◆ assemblyDirectivesDefinition

assemblyDirectivesDefinition<out List<AsmDirectiveDefinition> directives>
assemblyDirectiveDefinition<out AsmDirectiveDefinition first>
{ SYM_COMMA assemblyDirectiveDefinition<out AsmDirectiveDefinition other>
}
.

◆ assemblyDirectiveDefinition

assemblyDirectiveDefinition<out AsmDirectiveDefinition definition>
= stringLiteral<out Expr strLit>
assemblyIdentifier<out Identifier id>
.

◆ assemblyGrammarDefinition

assemblyGrammarDefinition<out List<AsmGrammarRuleDefinition> rules>
assemblyGrammarRuleDefinition<out AsmGrammarRuleDefinition first>
{ assemblyGrammarRuleDefinition<out AsmGrammarRuleDefinition other>
}
.

◆ assemblyGrammarRuleDefinition

assemblyGrammarRuleDefinition<out AsmGrammarRuleDefinition rule>
= assemblyIdentifier<out Identifier id> [assemblyGrammarTypeDefinition<out type>]
assemblyGrammarAlternatives<out AsmGrammarAlternativesDefinition alternatives>
.

◆ assemblyGrammarTypeDefinition

assemblyGrammarTypeDefinition<out AsmGrammarTypeDefinition type>
= SYM_AT assemblyIdentifier<out Identifier id>
.

◆ assemblyGrammarAlternatives

assemblyGrammarAlternatives<out AsmGrammarAlternativesDefinition alternatives>
= assemblyGrammarElements<out List<AsmGrammarElementDefinition> first>
{SYM_BINOR assemblyGrammarElements<out List<AsmGrammarElementDefinition> other>
}
.

◆ assemblyGrammarElements

assemblyGrammarElements<out List<AsmGrammarElementDefinition> elements>
= assemblyGrammarElement<out AsmGrammarElementDefinition element>
{ assemblyGrammarElement<out AsmGrammarElementDefinition furtherElement>
}
.

◆ assemblyGrammarElement

assemblyGrammarElement<out AsmGrammarElementDefinition element>
= (
( assemblyGrammarLiteral<out asmLiteral>
| assemblyGrammarGroup<out groupAlternatives> )
| assemblyGrammarGroup<out groupAlternatives>
| assemblyGrammarOptional<out optionAlternatives>
| assemblyGrammarRepetition<out repetitionAlternatives>
callOrBinaryExpression<out semanticPred, false, false>
| stringLiteral<out Expr strLit>
)
.

◆ assemblyLocalVarDeclaration

assemblyLocalVarDeclaration<out AsmGrammarLocalVarDefinition localVar>
= VAR
assemblyIdentifier<out Identifier id>
assemblyGrammarLiteral<out AsmGrammarLiteralDefinition asmLiteral>
.

◆ assemblyGrammarLiteral

assemblyGrammarLiteral<out AsmGrammarLiteralDefinition literal>
= ( assemblyIdentifier<out id>
[
| SYM_LT assemblyParameterList<out parameters>
(
]
| stringLiteral<out strLit> )
[IF(la.kind == _SYM_AT)
.

◆ assemblyParameterList

assemblyParameterList<out List<AsmGrammarLiteralDefinition> parameters>
= [ assemblyGrammarLiteral<out AsmGrammarLiteralDefinition literal>
{ SYM_COMMA assemblyGrammarLiteral<out AsmGrammarLiteralDefinition furtherLiteral>
}
]
.

◆ assemblyGrammarGroup

assemblyGrammarGroup<out AsmGrammarAlternativesDefinition alternatives>
assemblyGrammarAlternatives<out alternatives>
.

◆ assemblyGrammarOptional

assemblyGrammarOptional<out AsmGrammarAlternativesDefinition alternatives>
assemblyGrammarAlternatives<out alternatives>
.

◆ assemblyGrammarRepetition

assemblyGrammarRepetition<out AsmGrammarAlternativesDefinition alternatives>
assemblyGrammarAlternatives<out alternatives>
.

◆ statement

statement<out Statement statement>
= letStatement<out statement>
| ifStatement<out statement>
| blockStatement<out statement>
| raiseStatement<out statement>
| IF (la.kind == _MATCH && scanner.Peek().kind != _SYM_COLON)
matchStatement<out statement>
| IF (isMacroReplacementOfType(this, BasicSyntaxType.STAT))
macroReplacement<out Node n>
| assignmentOrCallStmt<out statement>
| lockStatement<out statement>
| forallStatement<out statement>
.

◆ blockStatement

blockStatement<out BlockStatement block>
statementList<out List<Statement> stmts>
.

◆ statementList

statementList<out List<Statement> stmts>
= {
IF (isMacroReplacementOfType(this, BasicSyntaxType.STATS))
macroReplacement<out Node n>
| statement<out Statement statement>
}
.

◆ assignmentOrCallStmt

assignmentOrCallStmt<out Statement statement>
= callOrBinaryExpression<out Expr target, false, false>
[
expression<out Expr expr, BIN_OPS>
]
.

◆ instructionCallStmt

instructionCallStmt<out InstructionCallStatement statement>
= identifierOrPlaceholder<out IdentifierOrPlaceholder id>
[
identifier<out Identifier argName>
expression<out Expr argExpr, BIN_OPS>
{
identifier<out argName>
expression<out argExpr, BIN_OPS>
}
]
[
expression<out Expr argExpr, BIN_OPS>
{
expression<out argExpr, BIN_OPS>
}
]
.

◆ letStatement

letStatement<out Statement letStatement>
= LET
identifier<out Identifier id>
{
identifier<out Identifier nextId>
}
( IF (la.kind == _IF_KW)
ifExpression<out valueExpr, BIN_OPS_EXCEPT_IN>
| IF (la.kind == _FORALL)
forallExpression<out valueExpr, BIN_OPS_EXCEPT_IN>
| expression<out valueExpr, BIN_OPS_EXCEPT_IN>
)
statement<out Statement body>
.

◆ ifStatement

ifStatement<out Statement ifStatement>
= IF_KW expression<out Expr condition, BIN_OPS>
THEN statement<out Statement thenStmt>
[ IF (la.kind == _ELSE)
ELSE statement<out elseStmt>
]
.

◆ raiseStatement

raiseStatement<out Statement raise>
statement<out Statement statement>
.

◆ matchStatement

matchStatement<out Statement match>
expression<out Expr candidate, BIN_OPS>
( expression<out pattern, BIN_OPS>
{
expression<out pattern, BIN_OPS>
}
expression<out pattern, BIN_OPS>
{
expression<out pattern, BIN_OPS>
}
)
statement<out Statement result>
{
IF (la.kind == _SYM_COMMA && scanner.Peek().kind != _SYM_UNDERSCORE)
( expression<out pattern, BIN_OPS>
{
expression<out pattern, BIN_OPS>
}
expression<out pattern, BIN_OPS>
{
expression<out pattern, BIN_OPS>
}
)
statement<out result>
}
[
statement<out defaultResult>
]
.

◆ lockStatement

lockStatement<out Statement lock>
= LOCK
callOrBinaryExpression<out Expr expr, false, false>
statement<out Statement statement>
.

◆ forallStatement

forallStatement<out Statement forall>
identifier<out Identifier indexName>
[
typeLiteral<out typeLiteral>
]
rangeExpression<out Expr domain>
{
identifier<out indexName>
[
typeLiteral<out typeLiteral>
]
rangeExpression<out domain>
}
statement<out Statement statement>
.

◆ expression

expression<out Expr expr, boolean allowedOps>
= term<out expr, allowedOps>
{
IF (allowedOps[la.kind] || la.kind == _SYM_AS || isMacroReplacementOfType(this, BasicSyntaxType.BIN_OP))
(
binaryOperator<out Operator op>
term<out Expr right, allowedOps>
| macroReplacement<out Node node>
term<out Expr right, allowedOps>
| SYM_AS
identifierPath<out IsId path>
{ IF (expr instanceof CastExpr && la.kind == _SYM_LT)
term<out Expr term, allowedOps>
[
IF (!allowedOps[_SYM_LT] || la.kind == _SYM_GT)
]
}
)
}
.

◆ callOrBinaryExpression

callOrBinaryExpression<out Expr expr, boolean allowLtOp, boolean allowWildcardArgs>
= IF (isIdentifierToken(la) || isMacroReplacementOfType(this, BasicSyntaxType.SYM_EX))
symbolOrBinaryExpression<out expr, allowLtOp>
{
IF (la.kind == _SYM_PAREN_OPEN && expr instanceof IsSymExpr)
arguments<out CallIndexExpr.Arguments args, allowWildcardArgs>
}
{
IF (la.kind == _SYM_DOT && expr instanceof IsSymExpr)
identifier<out Identifier id>
{
IF (la.kind == _SYM_PAREN_OPEN)
arguments<out CallIndexExpr.Arguments args, false>
}
}
| macroReplacement<out Node node>
.

Call expressions of form "a::b<3>(1,2)(3,4).c()". Due to the "<"-ambiguity with the less-than operator, this rule can also return a BinaryExpr. Use the "allowLtOp" parameter to disallow this behavior, e.g. in type literals.

◆ arguments

arguments<out CallIndexExpr.Arguments args, boolean allowWildcard>
argument<out Expr arg, allowWildcard>
{
argument<out Expr nextArg, allowWildcard>
}
.

Represents one set of invocation arguments. Multiple invocations (e.g. multi-dimensional access) will need multiple arguments. If allowWildcard is true, a argument may be *, which will yield a WildcardLiteral expression.

◆ argument

argument<out Expr arg, boolean allowWildcard>
| expression<out arg, BIN_OPS>
expression<out Expr rangeTo, BIN_OPS>
]
.

◆ symbolOrBinaryExpression

symbolOrBinaryExpression<out Expr expr, boolean allowLtOp>
= IF (isIdentifierToken(la) || isMacroReplacementOfType(this, BasicSyntaxType.ID))
identifierPath<out IsId path>
[
IF (la.kind == _SYM_LT)
term<out Expr term, BIN_OPS>
[
IF (!allowLtOp || la.kind == _SYM_GT)
]
]
| macroReplacement<out Node node>
.

◆ binaryOperator

◆ unary

unary<out Expr expr, boolean allowedOps>
= unaryOperator<out IsUnOp op>
term<out Expr operand, allowedOps>
.

◆ unaryOperator

unaryOperator<out IsUnOp op>
| macroReplacement<out Node n>
.

◆ term

term<out Expr expr, boolean allowedOps>
= literal<out expr>
| IF (la.kind == _MATCH && scanner.Peek().kind != _SYM_COLON)
matchExpression<out expr>
| IF (isIdentifierToken(la) || isMacroReplacementOfType(this, BasicSyntaxType.CALL_EX))
callOrBinaryExpression<out expr, true, false>
| groupedExpression<out expr>
| IF(isUnaryOperator(la) || isMacroReplacementOfType(this BasicSyntaxType.UN_OP))
unary<out expr, allowedOps>
| resourceReference<out expr>
| ifExpression<out expr, allowedOps>
| letExpression<out expr, allowedOps>
| existsExpression<out expr>
| forallExpression<out expr, allowedOps>
| macroReplacement<out Node n>
.

◆ groupedExpression

groupedExpression<out GroupedExpr expr>
expression<out Expr inner, BIN_OPS>
{
expression<out Expr next, BIN_OPS>
}
.

◆ literal

literal<out Expr expr>
= valLiteral<out expr>
| stringLiteral<out expr>
.

◆ valLiteral

valLiteral<out Expr expr>
= boolLiteral<out expr>
| intLiteral<out expr>
| binLiteral<out expr>
.

◆ intLiteral

intLiteral<out Expr expr>
= decLit
.

◆ binLiteral

binLiteral<out Expr expr>
= (hexLit | binLit)
.

◆ boolLiteral

boolLiteral<out Expr expr>
= TRUE
| FALSE
.

◆ referenceLiteral

referenceLiteral<out IsId reference>
identifierPath<out reference>
.

◆ identifierPath

identifierPath<out IsId path>
= identifierOrPlaceholder<out IdentifierOrPlaceholder id>
{
identifierOrPlaceholder<out IdentifierOrPlaceholder next>
}
.

◆ rangeExpression

rangeExpression<out Expr expr>
= expression<out expr, BIN_OPS>
[ SYM_RANGE expression<out Expr to, BIN_OPS> ]
.

◆ letExpression

letExpression<out Expr expr, boolean allowedOps>
= LET
identifier<out Identifier id>
{
identifier<out Identifier nextId>
}
( IF (la.kind == _IF_KW)
ifExpression<out valueExpr, BIN_OPS_EXCEPT_IN>
| IF (la.kind == _FORALL)
forallExpression<out expr, BIN_OPS_EXCEPT_IN>
| expression<out valueExpr, BIN_OPS_EXCEPT_IN>
)
expression<out Expr body, allowedOps>
.

◆ ifExpression

ifExpression<out Expr expr, boolean allowedElseOps>
expression<out Expr condition, BIN_OPS>
THEN expression<out Expr thenExpr, BIN_OPS>
ELSE expression<out Expr elseExpr, allowedElseOps>
.

◆ matchExpression

matchExpression<out Expr expr>
expression<out Expr candidate, BIN_OPS>
{
( expression<out Expr pattern, BIN_OPS>
{
expression<out pattern, BIN_OPS>
}
expression<out Expr pattern, BIN_OPS>
{
expression<out pattern, BIN_OPS>
}
)
expression<out Expr result, BIN_OPS>
}
expression<out Expr defaultResult, BIN_OPS>
.

◆ existsExpression

existsExpression<out Expr expr>
( IF (la.kind == _SYM_IN)
operationsList<out List<IsId> operations>
| identifierOrPlaceholder<out IdentifierOrPlaceholder id>
operationsList<out List<IsId> operations>
{
operationsList<out operations>
}
expression<out Expr thenExpr, BIN_OPS>
)
.

◆ operationsList

operationsList<out List<IsId> operations>
identifierPath<out IsId path>
{
identifierPath<out path>
}
.

◆ forallExpression

forallExpression<out Expr forallExpr, boolean allowedOps>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
[
typeLiteral<out typeLiteral>
]
rangeExpression<out Expr domain>
{
[
typeLiteral<out typeLiteral>
]
rangeExpression<out domain>
}
( TENSOR
| FOLD
( binaryOperator<out Operator operator>
| macroReplacement<out Node node>
)
)
expression<out Expr expr, allowedOps>
.

◆ typeLiteral

typeLiteral<out TypeLiteral type>
= identifierPath<out IsId path>
{
expression<out Expr sizeExpr, BIN_OPS_EXCEPT_GT>
}
.

◆ identifier

identifier<out Identifier identifier>
.

◆ allowedIdentifierKeywords

◆ assemblyIdentifier

◆ assemblyAllowedIdentifierKeywords

◆ sequenceCallExprList

sequenceCallExprList<out List<ExpandedSequenceCallExpr> list>
= ( sequenceCallExpr<out SequenceCallExpr call>
sequenceCallExpr<out SequenceCallExpr call>
{
sequenceCallExpr<out call>
}
)
.

◆ sequenceCallExpr

sequenceCallExpr<out SequenceCallExpr call>
=
identifier<out Identifier id1>
{
arguments<out CallIndexExpr.Arguments args, false>
|
rangeExpression<out range>
}
.

◆ macroReplacement

macroReplacement<out Node body>
= ( macroMatch<out body>
| maximumMacroExpr<out body>
| AsId<out body>
| AsStr<out body>
)
.

◆ AsId

AsId<out Node body>
groupedExpression<out GroupedExpr expr>
.

◆ AsStr

AsStr<out Node body>
groupedExpression<out GroupedExpr expr>
.

◆ macroMatch

macroMatch<out Node node>
basicSyntaxType<out SyntaxType type>
macroReplacement<out Node candidate>
macroBody<out Node match, candidate.syntaxType>
{
macroReplacement<out candidate>
macroBody<out match, candidate.syntaxType>
}
macroBody<out Node result, type>
{
macroReplacement<out candidate>
macroBody<out match, candidate.syntaxType>
{
macroReplacement<out candidate>
macroBody<out match, candidate.syntaxType>
}
macroBody<out result, type>
}
macroBody<out Node defaultChoice, type>
.

◆ maximumMacroExpr

Parses the longest macro expression (either instance or placeholder) from the parser.

maximumMacroExpr<out Node node>
identifier<out Identifier id>
{ IF (macro == null && la.kind == _SYM_DOT && paramType instanceof RecordType record)
identifier<out Identifier next>
}
[
IF (la.kind == _SYM_PAREN_OPEN && (macro != null || paramType instanceof ProjectionType))
(
IF (la.kind == _SYM_PAREN_CLOSE)
|
macroBody<out Node arg1, params.next>
{
macroBody<out Node arg2, params.next>
}
)
]
.

◆ macroDefinition

macroDefinition<out ModelDefinition def>
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
[
identifier<out Identifier paramId1>
syntaxType<out SyntaxType synType1>
{
identifier<out Identifier paramId2>
syntaxType<out SyntaxType synType2>
}
]
syntaxType<out SyntaxType returnType>
macroBody<out Node body, returnType>
.

◆ macroBody

macroBody<out Node body, SyntaxType type>
= (
IF (type == BasicSyntaxType.STATS)
statementList<out List<Statement> stmts>
| IF (type == BasicSyntaxType.STAT)
statement<out body>
| IF (type == BasicSyntaxType.ENCS)
| IF (type == BasicSyntaxType.ISA_DEFS)
isaDefinitionList<out List<Definition> defs>
| IF (type == BasicSyntaxType.COMMON_DEFS)
commonDefinitionList<out List<Definition> defs>
| IF (type == BasicSyntaxType.EX)
expression<out body, BIN_OPS>
| IF (type == BasicSyntaxType.LIT)
( literal<out body>
| macroReplacement<out body>
)
| IF (type == BasicSyntaxType.STR)
( stringLiteral<out body>
| macroReplacement<out body>
)
| IF (type == BasicSyntaxType.VAL)
( valLiteral<out body>
| macroReplacement<out body>
)
| IF (type == BasicSyntaxType.BOOL)
( boolLiteral<out body>
| macroReplacement<out body>
)
| IF (type == BasicSyntaxType.INT)
( intLiteral<out body>
| macroReplacement<out body>
)
| IF (type == BasicSyntaxType.BIN)
( binLiteral<out body>
| macroReplacement<out body>
)
| IF (type == BasicSyntaxType.CALL_EX)
callOrBinaryExpression<out body, false, false>
| IF (type == BasicSyntaxType.SYM_EX)
symbolOrBinaryExpression<out body, false>
| IF (type == BasicSyntaxType.ID)
identifierOrPlaceholder<out IdentifierOrPlaceholder id>
| IF (type == BasicSyntaxType.BIN_OP)
( binaryOperator<out Operator op>
| macroReplacement<out body>
)
| IF (type == BasicSyntaxType.UN_OP)
unaryOperator<out IsUnOp op>
| IF (type instanceof RecordType recordType)
macroBody<out Node entry, nextEntry.next.type>
{
macroBody<out entry, nextEntry.next.type>
}
| macroReplacement<out body>
)
| IF (type instanceof ProjectionType projection)
( identifier<out Identifier id>
| macroReplacement<out body>
)
| IF (type == BasicSyntaxType.INVALID)
)
.

◆ unreachableRule

◆ syntaxType

syntaxType<out SyntaxType type>
= IF (la.kind == _identifierToken)
identifier<out Identifier id>
| projectionType<out type>
| basicSyntaxType<out type>
.

◆ projectionType

projectionType<out ProjectionType type>
[
syntaxType<out SyntaxType argType>
{ SYM_COMMA syntaxType<out argType> }
]
syntaxType<out SyntaxType resultType>
.

◆ basicSyntaxType