Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2eae639
Move template spec from topology ports PR
Kronos3 Sep 8, 2025
4c61c9d
Added analysis passes for template definitions and fully qualified id…
Kronos3 Sep 10, 2025
f66f6a8
Update qual ident
Kronos3 Sep 10, 2025
4b09d87
Merge remote-tracking branch 'origin/topology-ports-spec' into templa…
Kronos3 Sep 17, 2025
5001d63
Update scoping of names
Kronos3 Sep 18, 2025
549587e
Merge remote-tracking branch 'origin/feature/topology-ports' into tem…
Kronos3 Sep 25, 2025
cf69b26
Update spec
Kronos3 Oct 2, 2025
15e3593
Simplify module template spec
Kronos3 Oct 8, 2025
efd2c46
Merge remote-tracking branch 'origin/feature/topology-ports' into tem…
Kronos3 Oct 28, 2025
d23c5da
Update spec
Kronos3 Dec 2, 2025
ad00aa3
Add spec for entering/resolving symbols in template
Kronos3 Feb 25, 2026
9344479
Specify port interface behavior for template parameters
Kronos3 Feb 27, 2026
3eb5d01
Merge remote-tracking branch 'origin/main' into templates-spec
Kronos3 Mar 18, 2026
b9704b9
Updated spec to address review
Kronos3 Mar 18, 2026
4371954
Merge branch 'main' into templates-spec
bocchino Apr 13, 2026
5328fb5
Revise version stamp
bocchino Apr 13, 2026
3244cde
Revise Scoping of Names
bocchino Apr 13, 2026
066a3f3
Revise Scoping of Names
bocchino Apr 13, 2026
d33a24e
Revise spec
bocchino Apr 14, 2026
511ae91
Revise spec
bocchino Apr 14, 2026
7fc0eff
Revise spec
bocchino Apr 14, 2026
c62ffe0
Revise spec
bocchino Apr 14, 2026
c8ed1e6
Revise spec
bocchino Apr 14, 2026
19495cb
Revise spec
bocchino Apr 14, 2026
526c37e
Revise spec
bocchino Apr 14, 2026
e94ec23
Revise spec
bocchino Apr 14, 2026
409e11c
Revise spec
bocchino Apr 14, 2026
9edd501
Revise spec
bocchino Apr 14, 2026
b98fad7
Revise spec
bocchino Apr 14, 2026
bcadeb1
Revise spec
bocchino Apr 14, 2026
60e4eb0
Revise spec
bocchino Apr 14, 2026
58a749e
Revise spec
bocchino Apr 14, 2026
ef606b8
Revise spec
bocchino Apr 14, 2026
81ef028
Revise spec
bocchino Apr 14, 2026
37637d0
Revise spec
bocchino Apr 14, 2026
e7499c4
Revise spec
bocchino Apr 14, 2026
d1023a5
Revise spec
bocchino Apr 14, 2026
aa3bcf2
Revise spec
bocchino Apr 14, 2026
1250a53
Revise spec
bocchino Apr 14, 2026
57626c6
Revise spec
bocchino Apr 15, 2026
43f9619
Merge branch 'feature/templates' into templates-spec
bocchino Apr 15, 2026
fc60ddf
Revise spec
bocchino Apr 15, 2026
35d76bf
Revise spec
bocchino Apr 16, 2026
4beeafe
Revise spec
bocchino Apr 16, 2026
c8a89fa
Revise spec
bocchino Apr 17, 2026
ccca08f
Revise spec
bocchino Apr 17, 2026
5c3d09f
Revise spec
bocchino Apr 17, 2026
3a115e1
Revise spec
bocchino Apr 17, 2026
ffab3d6
Revise spec
bocchino Apr 20, 2026
187d8a3
Revise spec
bocchino Apr 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/code-prettify/run_prettify.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ var IN_GLOBAL_SCOPE = false;
"event," +
"every," +
"exit," +
"expand," +
"external," +
"fatal," +
"format," +
Expand Down Expand Up @@ -496,6 +497,7 @@ var IN_GLOBAL_SCOPE = false;
"struct," +
"sync," +
"telemetry," +
"template," +
"text," +
"throttle," +
"time," +
Expand Down
1,958 changes: 1,477 additions & 481 deletions docs/fpp-spec.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/fpp-users-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.26">
<title>The F Prime Prime (FPP) User&#8217;s Guide, v3.2.0</title>
<title>The F Prime Prime (FPP) User&#8217;s Guide, Unreleased, after v3.2.0</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<style>
/*! Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
Expand Down Expand Up @@ -437,7 +437,7 @@
</head>
<body class="article toc2 toc-left">
<div id="header">
<h1>The F Prime Prime (FPP) User&#8217;s Guide, v3.2.0</h1>
<h1>The F Prime Prime (FPP) User&#8217;s Guide, Unreleased, after v3.2.0</h1>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
Expand Down Expand Up @@ -17089,7 +17089,7 @@ <h3 id="Writing-C-Plus-Plus-Implementations_Serialization-of-FPP-Values">17.4. S
</div>
<div id="footer">
<div id="footer-text">
Last updated 2026-03-27 10:18:33 -0700
Last updated 2026-04-20 13:42:58 -0700
</div>
</div>
<script src="code-prettify/run_prettify.js"></script>
Expand Down
5 changes: 4 additions & 1 deletion docs/spec/Analysis-and-Translation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ It usually involves the following steps:

. Lexing and parsing to generate an abstract syntax tree (AST).

. If step (1) succeeded, semantic analysis of the AST.
. If step (1), succeeded, <<Expansion-of-Templates,analysis and expansion of
templates>> to generate a new AST.

. If step (2) succeeded, semantic analysis of the AST generated in step (2).

=== Analysis Tools

Expand Down
6 changes: 2 additions & 4 deletions docs/spec/Definitions-and-Uses.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

A *use* is a
<<Scoping-of-Names_Qualified-Identifiers,qualified identifier>>
that refers to a
<<Definitions,definition>>
according to the
that refers to a <<Definitions,definition>> according to the
<<Scoping-of-Names_Resolution-of-Qualified-Identifiers,scoping rules for names>>.

A use is a *qualifying use* if it qualifies another use. For example, in
Expand Down Expand Up @@ -152,7 +150,7 @@ module M {

An error also occurs if the rules
for resolving <<Expressions_Dot-Expressions_Semantics,dot expressions>>
causes an implied constant use to be resolved to a member
cause an implied constant use to be resolved to a member
of a struct value instead of a constant definition. For example, suppose this
definition exists in the model:

Expand Down
36 changes: 36 additions & 0 deletions docs/spec/Definitions/Introduction.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,39 @@

A *definition* is a unit of syntax that introduces a name _N_
and associates some code with _N_.

In FPP, there are two kinds of definitions:

. *Global definitions* that introduce globally visible
<<Scoping-of-Names_Names-of-Definitions,qualified names>>.

. *Bound parameter definitions* introduced by binding
<<Specifiers_Template-Expansion-Specifiers,template arguments>> to
<<Template-Parameter-Lists,template parameters>> within
the scope of an <<Expansion-of-Templates,expanded template>>.
A bound parameter definition is a pair stem:[(p, A)] consisting of
a template parameter _p_ and a template argument _A_.
The name associated with a bound parameter definition stem:[(p, A)]
is the identifier specified in _p_.
Bound parameter definitions come into scope
<<Scoping-of-Names_Resolution-of-Identifiers_Inside-an-Expanded-Template,during
template expansion>>.

Within an expanded template, a bound parameter definition may *represent*
a global definition, either directly or indirectly.
A bound parameter definition stem:[B = (p, A)] represents
a global definition _D_ if (1) _A_
<<Scoping-of-Names_Resolution-of-Identifiers,refers to>> _D_ or (2)
_A_ refers to a bound parameter definition _B'_ that represents _D_.

Not all bound parameter definitions represent global definitions.
For example, the bound parameter definition

[source,fpp]
----
( constant x : U32 , 0 )
----

does not represent any global definition.

The rest of this section discusses the global definitions.
4 changes: 4 additions & 0 deletions docs/spec/Definitions/Module-Definitions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ A module member is one of the following:

* A <<Definitions_Topology-Definitions,topology definition>>

* A <<Definitions_Module-Template-Definitions,module template definition>>

* A <<Specifiers_Template-Expansion-Specifiers,template expansion specifier>>

* A <<Specifiers_Location-Specifiers,location specifier>>

* An <<Definitions_Abstract-Type-Definitions,abstract type definition>>
Expand Down
95 changes: 95 additions & 0 deletions docs/spec/Definitions/Module-Template-Definitions.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
=== Module Template Definitions

A *module template definition* associates a name
with a *module template*.
A module template is a set of syntactic elements, each of which
becomes a member of a <<Translation-Units-and-Models_Translation-Units,
translation unit>> or a
<<Definitions_Module-Definitions,module definition>>
at the point where the template is <<Expansion-of-Templates,expanded>>.
Each template may be expanded any number of times, and
each expansion creates a distinct set of translation unit
or module members.
Templates may have parameters that become bound
to <<Specifiers_Template-Expansion-Specifiers,arguments>>
at the point of expansion.

==== Syntax

`module` `template`
<<Lexical-Elements_Identifiers,_identifier_>>
_[_
`(` <<Template-Parameter-Lists,_template-param-list_>> `)`
_]_
`{`
_module-member-sequence_
`}`

_module-member-sequence_ is identical to the module member sequence
of a <<Definitions_Module-Definitions,module definition>>.

==== Semantics

The identifier is the name of the template.

No module template definition may be the ancestor in the
abstract syntax tree of another module template definition
or of a <<Specifiers_Template-Expansion-Specifiers,template expansion specifier>>.
This rule ensures that <<Expansion-of-Templates,expanding a template>>
never causes another template to be defined or another
template expansion to occur.

Each module template definition _M_ that appears in a model
must pass the following analysis, regardless of whether it
is expanded.

. Expand _M_ at the point of the definition of _M_, providing the following
<<Specifiers_Template-Expansion-Specifiers,arguments for the template
parameters>>:

.. For each constant template parameter, a literal value of the correct type.

.. For each port interface instance template argument, a component
instance definition that minimally satisfies the interface.

.. For each type template argument, an abstract type definition.

. In the expansion _E_, do the following:

.. Construct the <<Definitions-and-Uses_Use-Def-Graph,use-def
graph>>, checking for cycles.

.. Compute the types associated with type definition symbols, enumerated
constant symbols, and type names, except that array size expressions
and default value expressions are still unevaluated.

.. Perform <<Type-Checking,type checking>>,
except that array size expressions and default value expressions in type
definitions are still unevaluated.

==== Example

[source,fpp]
----
template MT(
constant baseId: FwIdType
instance comDriver: Drv.ByteStreamDriver
) {

instance comStub: Svc.ComStub base id \
baseId + 0x0800

topology T {
instance comDriver
instance comStub

# Connect to the driver from the parameter list
connections Downlink {
comStub.drvSendOut -> comDriver.$send
comDriver.sendReturnOut -> comStub.drvSendReturnIn
comDriver.ready -> comStub.drvConnected
}
}

}
----
Loading