Grammar
This EBNF gives the syntax the parser accepts. Which members a block takes, their types and units, procedure fields and operation signatures are checked after parsing, against closed registries; they are listed in the declaration reference, the procedure reference and operations and output queries.
Modules and declarations
module = import* declaration*
import = "import" import-kind name "from" string
import-kind = "geometry" | "mesh" | "material" | "model" | "study" | "sweep" | "execution" | "function"
declaration = geometry | mesh | material | model | study | sweep | execution | table
geometry = "geometry" name ("from" reference)? block
mesh = "mesh" name "on" reference block
material = "material" name ("from" expression)? block
model = "model" name parameter-list? block
study = "study" name block
sweep = "sweep" name "over" reference block
execution = "execution" name block
table = "table" name ":" name "over" name block
parameter-list = "(" parameter ("," parameter)* ","? ")"
parameter = "region" name ":" type | name ":" type
block = "{" statement* "}"Statements
statement = input | let | assignment | requirement | property-assignment | applied-load
| output | output-definition | include | retain | use | command
| feature | source-update | signal | sample | generated
| model-definition | nested-block
input = "input" name ":" type ("=" expression | block)?
let = "let" name "=" expression
assignment = reference "=" expression
requirement = reference ("<=" | ">=") expression (* memory_per_worker <= 32 GiB *)
property-assignment = "assign" expression "to" expression (* assign material.steel to geometry.g.region.body *)
applied-load = name "on" expression "=" expression (* traction on geometry.g.region.end = [0, 0, -1] kPa *)
output = "output" name "=" expression
output-definition = "output" name block
include = "include" expression
retain = "retain" name
use = "use" reference
command = ("select" | "expect" | "require") word+ (* select name "Beam"; expect exactly_one *)
feature = "feature" name "=" expression
source-update = "set" reference "=" expression (* set source.parameter.wall = 3 mm *)
signal = "signal" name ":" name "over" name block
sample = "sample" "from" expression "to" expression "at" expression
generated = "generated" "by" reference block (* generated by function.impactPulse { … } *)
model-definition = definition-kind name block
definition-kind = "section" | "layup" | "orientation" | "constraint" | "load" | "load_case"
| "interface" | "connector" | "excitation" | "response_spectrum"
| "random_excitation" | "initial"
nested-block = header block (* region body : solid { … }, analysis s after analysis.p { … } *)
header = word+Typical headers of nested blocks are region <name> : <role>, analysis <name> and analysis <name> after analysis.<step>, <family> <procedure> inside an analysis, a constraint or load kind such as structural.fixed, refine <name>, axis <input>, case <name>, cad_parameter <name> : <type>, and the capability blocks of a material (elastic, thermal).
Expressions
expression = comparison
comparison = range (("==" | "!=" | "<" | "<=" | ">" | ">=") range)?
range = additive (".." additive)?
additive = multiplicative (("+" | "-") multiplicative)*
multiplicative = unary (("*" | "/") unary)*
unary = ("+" | "-") unary | power
power = postfix ("^" unary)?
postfix = primary quantity-unit?
primary = number | string | reference | call | prefix-call
| list | record | "(" expression ")"
reference = name ("." name)*
call = reference "(" (argument ("," argument)* ","?)? ")"
prefix-call = reference expression (* collect case.output.peak *)
argument = expression | name "=" expression
list = "[" (expression ("," expression)* ","?)? "]"
record = "{" (name "=" expression ("," name "=" expression)* ","?)? "}"
quantity-unit = unit-expression (* after a number, list or group *)
unit-expression = unit-factor (("*" | "/") unit-factor)*
unit-factor = unit-symbol ("^" "-"? integer)?
type = name ("<" name ">")? (* force, region<solid> *)
name = identifier | keywordA unit follows a number (8 mm), a list ([0, 0, -100000] Pa) or a parenthesized group. The unit symbols are listed in the units table.
Lexical rules
- Statements end at a line break when the preceding token cannot continue an expression. A semicolon ends a statement explicitly, so several statements fit on one line:
region body : solid { select name "Beam"; expect exactly_one }. - Separators. Commas separate call arguments, parameters, list items and record fields; a trailing comma is allowed.
- Comments.
//starts a comment that runs to the end of the line. - Names are case-sensitive. A keyword can appear as a segment of a reference (
load.end_traction,analysis.static) and as a declared name Not yet releasedStatus. - Strings use double or single quotes and support the escapes
\n,\r,\t,\",\'and\\. - Numbers are decimal, with an optional fraction and exponent (
7850,0.3,12e-6).
Precedence
From tightest to loosest: a unit attached to its number, exponentiation, unary sign, multiplication and division, addition and subtraction, the range .., and comparisons. Parentheses override precedence. Assignment is a statement, not an expression.
Example
study static_check {
input service_load : force = 1.5 kN
geometry = geometry.bracket
mesh = mesh.bracket
model = model.loaded(service_load = input.service_load)
analysis solve { structural static {} }
output peak = max(
magnitude(analysis.solve.field.node.displacement),
over = geometry.bracket.region.body,
)
}Formatting and error recovery
The language server formats a file into one canonical layout on request. After a syntax error the parser resumes at the next statement or declaration boundary, so one error does not hide the rest of the file.