The Core-2 component, physical-model and realization grammar overlay.
Core-2 grammar
(* Core-2 overlay on Core-1 and Core-0. Replace domain/effect/unary-operator below.
Append component-declaration, physical-model-declaration and
realization-declaration to implementation-top-level-declaration.
Append hardware-type and physical-type to type. Other productions retain
their inherited meaning. New declaration keywords are contextual only in
these productions; they do not reinterpret old-edition identifiers.
expression, type, visibility, identifier, authoring-modality,
integer-literal and string-literal are inherited. Physical expressions
use the inherited expression syntax with the pure mathematical typing in
C2-PHYS-004, not software assignment/effect semantics. *)
domain = "algorithm" | "compute" | "state" | "flow" | "optimize" | "hardware" ;
effect = "io" | "alloc" | "time" | "random" | "reflect" | "unsafe"
| "abort" | "compute" | "state" | "flow" | "optimize"
| "hardware" | "physics" ;
unary-operator = "!" | "-" | "~" ;
(* Make C1-MOD-001 explicit for the inherited value-specific production too.
Value messages retain Core-0's sealed, block-bodied member shape; portable
templates retain the Core-1 domain-set and per-message modality. *)
value-message-declaration = visibility , authoring-modality ,
( domain | "portable" , domain-set ) , "message" , message-selector ,
[ generic-parameters ] , "(" , receiver-parameter ,
[ "," , value-parameter-list ] , ")" , "->" , type ,
{ requirement-clause } , [ precondition-clause ] , [ postcondition-clause ] ,
effect-clause , block ;
qualified-name = identifier , { "." , identifier } ;
width = integer-literal | identifier ;
hardware-type = "Bit" | "Logic" | "Clock" | "Reset"
| ( "Bits" | "Logic" ) , "<" , width , ">"
| "Hardware" , "<" , qualified-name , ">" ;
physical-type = ( "Quantity" | "Scalar" | "Vector" | "Tensor" ) ,
"<" , qualified-name , ">"
| "SolverPlan" , "<" , qualified-name , ">" ;
binding = identifier , "=" , expression ;
bindings = "(" , [ binding , { "," , binding } ] , ")" ;
component-declaration = visibility , authoring-modality , "hardware" ,
"component" , identifier , [ static-parameters ] ,
"(" , [ port , { "," , port } ] , ")" , "{" , { component-item } , "}" ;
static-parameters = "<" , identifier , ":" , "Index" ,
{ "," , identifier , ":" , "Index" } , ">" ;
port = ( "in" | "out" | "inout" ) , identifier , ":" , type ;
component-item = net-declaration | instance-declaration | clock-declaration
| region-declaration | bridge-declaration | fact-declaration
| observation-declaration ;
net-declaration = "net" , identifier , ":" , type ,
[ "resolve" , qualified-name ] , ";" ;
instance-declaration = "instance" , identifier , ":" , qualified-name ,
[ "<" , width , { "," , width } , ">" ] , bindings , ";" ;
clock-declaration = "clock" , identifier , "=" , ( "rising" | "falling" ) ,
"(" , qualified-name , ")" , [ "reset" , qualified-name ,
"active" , ( "high" | "low" ) , "mode" ,
( "synchronous" | "asynchronous" ) ] , ";" ;
discipline = "combinational" | "clocked" | "asynchronous" | "intrinsic" ;
region-declaration = "region" , identifier , ":" , discipline , "{" ,
{ region-item } , "}" ;
region-item = connection | register-declaration | async-state-declaration
| process-declaration | fact-declaration ;
connection = "connect" , qualified-name , "=" , expression , ";" ;
register-declaration = "register" , identifier , ":" , type ,
"on" , identifier , "=" , expression , ";" ;
async-state-declaration = "state" , identifier , ":" , type , "=" , expression , ";" ;
process-declaration = "process" , identifier ,
( "on" , identifier | "when" , expression ) , "{" ,
{ ( "next" | "drive" ) , qualified-name , "=" , expression , ";" } , "}" ;
fact-declaration = ( "constraint" | "assume" ) , identifier , "=" , expression , ";" ;
bridge-declaration = "bridge" , identifier , ":" , qualified-name , bindings , ";" ;
observation-declaration = "observe" , identifier , "=" , expression , ";" ;
physical-model-declaration = visibility , "physical" , "model" , identifier ,
"{" , { model-item } , "}" ;
model-item = mesh-declaration | parameter-declaration | model-field
| material-declaration | equation-declaration | condition-declaration
| analysis-declaration | coupling-declaration | bridge-declaration
| observation-declaration | fact-declaration ;
mesh-declaration = "mesh" , identifier , "=" , expression , ";" ;
parameter-declaration = "parameter" , identifier , ":" , type , "=" , expression , ";" ;
(* This model-field production is local to model-item; the inherited object
field-declaration production is not replaced. *)
model-field = "field" , identifier , ":" , physical-type , "on" , qualified-name , ";" ;
material-declaration = "material" , identifier , "on" , qualified-name ,
"=" , expression , ";" ;
equation-declaration = "equation" , identifier ,
( "strong" | "weak" , "for" , identifier , "in" , qualified-name ) ,
expression , ";" ;
condition-declaration = "condition" ,
( "initial" | "boundary" | "interface" | "source" ) , identifier ,
"on" , qualified-name , "=" , expression , ";" ;
analysis-kind = "steady" | "transient" | "harmonic" | "eigenvalue" | "coupled" ;
analysis-declaration = "analysis" , identifier , ":" , analysis-kind ,
"{" , { fact-declaration | observation-declaration } , "}" ;
coupling-declaration = "couple" , identifier , ":" , qualified-name , bindings , ";" ;
realization-declaration = visibility , "realization" , identifier ,
"refines" , qualified-name , "with" , qualified-name ,
"profile" , ( discipline | analysis-kind ) , "claims" , claim , ";" ;
claim = "exact" | "bounded" , "(" , qualified-name , ")"
| "statistical" , "(" , qualified-name , ")" ;