Commit Graph

240 Commits

Author SHA1 Message Date
Will Hawkins 18461a9215 compiler: Remove Too-Early Instatiation Reference (3)
Continuous Integration / Library Format Tests (push) Successful in 1m16s
Continuous Integration / Library Tests (push) Successful in 4m32s
Continuous Integration / Grammar Tests (push) Successful in 38s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-27 13:39:26 -04:00
Will Hawkins ecc38096b8 compiler: Remove Too-Early Instatiation Reference (2)
Continuous Integration / Grammar Tests (push) Successful in 38s
Continuous Integration / Library Format Tests (push) Successful in 1m18s
Continuous Integration / Library Tests (push) Failing after 4m32s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-27 13:29:24 -04:00
Will Hawkins c8d4d4fc65 compiler: Remove Too-Early Instatiation Reference
Continuous Integration / Grammar Tests (push) Successful in 38s
Continuous Integration / Library Format Tests (push) Successful in 1m41s
Continuous Integration / Library Tests (push) Failing after 4m29s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-27 13:22:59 -04:00
Will Hawkins 294f76acd4 compiler: Refactor Compiler To Remove Ambiguities
Continuous Integration / Grammar Tests (push) Successful in 39s
Continuous Integration / Library Format Tests (push) Successful in 1m51s
Continuous Integration / Library Tests (push) Failing after 4m44s
There were significant overlaps in the names of data structures
between the compiler and the language that made it necessary
to litter the code with P4Lang.xxxx. This refactor removes that
requirement in most places (Parser is ambiguous wherever TreeSitter
is used -- cannot avoid that!)

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-27 12:59:29 -04:00
Will Hawkins 61d8f601e8 compiler, language, runtime: Separate Parser Type From Instances
Continuous Integration / Grammar Tests (push) Successful in 4m2s
Continuous Integration / Library Format Tests (push) Successful in 5m0s
Continuous Integration / Library Tests (push) Successful in 8m1s
In P4, parsers are considered types. Those parsers are instantiated.
The instantiated parsers are values. Previously, gp4 treated a parser
type and a parser value as identical. This PR makes that difference
clear _and_ sets the stage for the future.

TODO: Make the same distinction between control and action types and
values.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-27 05:41:23 -04:00
Will Hawkins 925f20a13b Make Formatter Happy
Continuous Integration / Grammar Tests (push) Successful in 37s
Continuous Integration / Library Format Tests (push) Successful in 1m49s
Continuous Integration / Library Tests (push) Successful in 4m50s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 20:42:50 -04:00
Will Hawkins 97a672bd6d compiler: Type Check All Binary Operators
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 20:42:35 -04:00
Will Hawkins bc51b4e280 compiler: Reworked Preprocessor To Support Better Error Messages
Can now support showing the trail of includes in an error
message.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 20:41:43 -04:00
Will Hawkins 041009a22e compiler: Track/Report Relative Paths Names
Continuous Integration / Grammar Tests (push) Successful in 37s
Continuous Integration / Library Format Tests (push) Successful in 1m22s
Continuous Integration / Library Tests (push) Successful in 4m23s
When the user gives relative path names for p4 files, report
those in error messages (etc.). The SourceManager can/does
resolve those to absolute path names.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 04:27:37 -04:00
Will Hawkins 0cb50e2e2f testing: Remove .swift-version
Continuous Integration / Library Format Tests (push) Successful in 1m12s
Continuous Integration / Library Tests (push) Failing after 4m18s
Continuous Integration / Grammar Tests (push) Successful in 40s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 03:54:36 -04:00
Will Hawkins 7fc319d9bc testing: Debug Format CI Test Failure (2)
Continuous Integration / Grammar Tests (push) Successful in 37s
Continuous Integration / Library Format Tests (push) Failing after 1m17s
Continuous Integration / Library Tests (push) Has been cancelled
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 03:51:52 -04:00
Will Hawkins 0c8b9e88cf testing: Debug Format CI Test Failure
Continuous Integration / Grammar Tests (push) Successful in 37s
Continuous Integration / Library Format Tests (push) Failing after 1m37s
Continuous Integration / Library Tests (push) Failing after 4m15s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 02:39:12 -04:00
Will Hawkins e53c32f802 compiler, cli: Support Nice Compilation Error Messages
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 02:38:47 -04:00
Will Hawkins 5845cb75cc testing: Test For Controls Using Keys From Structs
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 02:35:34 -04:00
Will Hawkins 24b0f0284a language: Check For Incorrect Order For Action Parameters
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 02:34:51 -04:00
Will Hawkins a1908cc077 Make Formatter Happy
Continuous Integration / Library Tests (push) Successful in 4m8s
Continuous Integration / Grammar Tests (push) Successful in 36s
Continuous Integration / Library Format Tests (push) Failing after 1m12s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 00:27:17 -04:00
Will Hawkins 382f3de00a testing: Use ProcessInfo As Static Variable
Continuous Integration / Grammar Tests (push) Successful in 37s
Continuous Integration / Library Format Tests (push) Failing after 1m40s
Continuous Integration / Library Tests (push) Successful in 4m12s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 00:19:05 -04:00
Will Hawkins 8f9fbb86bf testing: Cli Tests Are Now Integrated
Continuous Integration / Grammar Tests (push) Successful in 37s
Continuous Integration / Library Format Tests (push) Failing after 1m27s
Continuous Integration / Library Tests (push) Failing after 4m14s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 00:11:07 -04:00
Will Hawkins 16a798cc39 testing: Update to Latest ABI Protocol for Test Discovery
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-22 00:10:10 -04:00
Will Hawkins 017d5670c0 Make Formatter Happy
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-21 22:42:55 -04:00
Will Hawkins d60465e669 testing: Update CliTest Support.
And add tests for Cli preprocessing.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-21 22:41:00 -04:00
Will Hawkins b3ca30541a cli: Add a Preprocess Mode
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-21 22:40:14 -04:00
Will Hawkins 022dc94fde Commit To Swift Version 6.2.4
Continuous Integration / Grammar Tests (push) Successful in 38s
Continuous Integration / Library Format Tests (push) Failing after 1m20s
Continuous Integration / Library Tests (push) Failing after 4m34s
Continuous Integration / Cli Tests (push) Successful in 4m47s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-21 22:39:36 -04:00
Will Hawkins 7a2c55cc51 testing: Implement Macros For Cli Testing
Continuous Integration / Grammar Tests (push) Successful in 4m5s
Continuous Integration / Library Tests (push) Failing after 8m19s
Continuous Integration / Cli Tests (push) Successful in 6m36s
Continuous Integration / Library Format Tests (push) Successful in 5m0s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-20 17:53:31 -04:00
Will Hawkins 3cff82fd5c runtime: Remove Too-Soon Dependency on Protobuf Work
Continuous Integration / Grammar Tests (push) Successful in 4m18s
Continuous Integration / Library Format Tests (push) Successful in 7m30s
Continuous Integration / Library Tests (push) Successful in 10m36s
Continuous Integration / Cli Tests (push) Successful in 7m7s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-18 23:38:12 -04:00
Will Hawkins a7d8fd1304 grammar,compiler: Add Support For Fixed-Width Integers
Continuous Integration / Grammar Tests (push) Successful in 4m13s
Continuous Integration / Library Format Tests (push) Successful in 5m17s
Continuous Integration / Library Tests (push) Failing after 8m34s
Continuous Integration / Cli Tests (push) Failing after 4m40s
Distinguishing between signed and unsigned fixed-width integer
types must still be done.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-18 06:53:22 -04:00
Will Hawkins cbebcae20a language: Remove Attributed Type
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-18 05:06:28 -04:00
Will Hawkins 979fa69ab8 Rename Project (again) And Describe Purpose
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-18 04:01:28 -04:00
Will Hawkins 12fa43d9f9 common, codegen: Implement Visitor And Use For CodeGen
Continuous Integration / Grammar Tests (push) Successful in 4m6s
Continuous Integration / Library Format Tests (push) Successful in 5m5s
Continuous Integration / Library Tests (push) Successful in 9m0s
Continuous Integration / Cli Tests (push) Successful in 4m57s
Implement a generic visitor for components of a P4 program and use
it to start P4 code generation (according to the behavioral model).

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-15 08:14:24 -04:00
Will Hawkins f1f20e96a2 testing: Do Not Build Separately in Library Tests
Continuous Integration / Grammar Tests (push) Successful in 35s
Continuous Integration / Library Format Tests (push) Successful in 1m7s
Continuous Integration / Library Tests (push) Successful in 4m1s
Continuous Integration / Cli Tests (push) Successful in 5m47s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-11 09:06:59 -04:00
Will Hawkins 49eef16c19 testing: Add Basic Support for Cli Testing
Continuous Integration / Grammar Tests (push) Successful in 3m42s
Continuous Integration / Library Format Tests (push) Successful in 4m33s
Continuous Integration / Cli Tests (push) Successful in 4m18s
Continuous Integration / Library Tests (push) Successful in 9m39s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-11 08:57:15 -04:00
Will Hawkins fccaf1aa92 cli: Initial _real_ Cli Work
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-11 08:56:38 -04:00
Will Hawkins 73b4f54bbe Make Formatter Happy
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-11 07:37:23 -04:00
Will Hawkins 0e2b13be93 compiler: Support Querying For Files In Preprocessed Code
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-11 07:37:23 -04:00
Will Hawkins f0f7a660a6 compiler: Add Ability to Annotate Preprocessed Source
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-11 07:37:18 -04:00
Will Hawkins a0c6b7730c documentation: Document SourceCode-related structs
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-11 07:22:17 -04:00
Will Hawkins d28ccd79e4 common, compiler: Upgrade to SystemPackage
Continuous Integration / Grammar Tests (push) Successful in 35s
Continuous Integration / Library Format Tests (push) Successful in 1m16s
Continuous Integration / Library Tests (push) Successful in 4m11s
For cross-platform support.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-07 23:43:29 -04:00
Will Hawkins 355e62d61d testing: Update CI to Use Proper Image
Continuous Integration / Grammar Tests (push) Successful in 34s
Continuous Integration / Library Format Tests (push) Successful in 1m31s
Continuous Integration / Library Tests (push) Failing after 3m54s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-07 23:10:58 -04:00
Will Hawkins 754102d601 compiler: Add Preprocessor Support
TODO: Test that file names are properly tracked in included
files.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-07 23:06:41 -04:00
Will Hawkins fac1cc4948 testing: Use Full Runners for LLVM Support in Gitea CI
Continuous Integration / Grammar Tests (push) Successful in 1m39s
Continuous Integration / Library Tests (push) Successful in 4m33s
Continuous Integration / Library Format Tests (push) Successful in 1m14s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 08:25:49 -04:00
Will Hawkins 7308115d85 testing: Pin Tree Sitter Ref In CI
Continuous Integration / Grammar Tests (push) Failing after 1m22s
Continuous Integration / Library Tests (push) Failing after 1m18s
Continuous Integration / Library Format Tests (push) Failing after 1m19s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 08:19:29 -04:00
Will Hawkins ce35761efa Make Formatter Happy
Continuous Integration / Grammar Tests (push) Failing after 2m26s
Continuous Integration / Library Tests (push) Failing after 18s
Continuous Integration / Library Format Tests (push) Failing after 11s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 08:09:15 -04:00
Will Hawkins d9133cf6a9 cli: Remove Darwin Dependency
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 08:02:21 -04:00
Will Hawkins d6da7a519e testing: Build With Main Snapshot Version Of Toolchain in CI
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 07:56:47 -04:00
Will Hawkins 3f0444a8da testing: Build With Snapshot Version Of Toolchain in CI
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 07:54:54 -04:00
Will Hawkins df7a1ac15b testing: Build With Dev Version Of Toolchain in CI
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 07:48:49 -04:00
Will Hawkins 8552199ebe testing: Skip Verifying swiftly Signature in CI
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 07:20:45 -04:00
Will Hawkins a657db0b42 testing: Move to Ubuntu Runners in CI
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-06 07:14:05 -04:00
Will Hawkins dd0bbbe479 Make Formatter Happy
Continuous Integration / Grammar Tests (push) Failing after 5s
Continuous Integration / Library Tests (push) Failing after 5s
Continuous Integration / Library Format Tests (push) Failing after 6s
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-04 22:25:51 -04:00
Will Hawkins 7a36ca32dd compiler, runtime: Support Formatted Error Messages
Make it possible to output formatted error messages using a
flexible API that includes an ability to specify styles and
formatters.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
2026-05-04 22:24:28 -04:00