compiler, runtime, common, testing: Support Directions on Parameters and Attributed Types

Add support for directions on parameters and attributed types. The
latter is necessary to support the former, but is not limited to
the direction use case. An attributed type is a P4 type with attributes
(like its direction, whether it is read only, etc.) Other attributes
will be added in the future.

Changes necessary to support attributed types include:
1. Global instances tracked during compilation are not attributed
types and not simply types.
2. (future) Type checking will have to make sure that a types
attributes do not affect type compatibility.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-04-13 06:25:08 -04:00
parent 9669a99dfc
commit 35b2537754
17 changed files with 209 additions and 64 deletions
+12
View File
@@ -14,3 +14,15 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import Common
public struct AttributedP4Type {
public let type: P4Type
public let attributes: P4TypeAttributed
public init(_ type: P4Type, _ attributes: P4TypeAttributed) {
self.type = type
self.attributes = attributes
}
}