Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bit-string concatenation not supported #110

Closed
smolkaj opened this issue Oct 20, 2016 · 2 comments
Closed

bit-string concatenation not supported #110

smolkaj opened this issue Oct 20, 2016 · 2 comments

Comments

@smolkaj
Copy link
Member

smolkaj commented Oct 20, 2016

The spec defines a concatenation operator ++ on bit strings:

Concatenation of two bit-strings, resulting in a bit-string whose length is the sum of the lengths, designated by the infix operator ++. The left bit-string provides the most significant bits.

However, the compiler does not currently seem to support it:

includes/parser.p4(378): error: ++: Concatenation not defined on bit<13> and bit<4>
        transition select(hdr.ipv4.fragOffset ++ hdr.ipv4.ihl ++ hdr.ipv4.protocol) {
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@mihaibudiu
Copy link
Contributor

I have pushed a fix for this; it's sitting in my pull request queue.
It was a copy-and-paste bug in the typeChecker.
There was another bug in the parser which assigned the wrong precedence to the ++, higher than +, which didn't fit with the DBPrint precedence.

ChrisDodd pushed a commit that referenced this issue Oct 20, 2016
* Fixed incorrect handling of current()

* Fix for issue #100

* Lexer fix for integer literals; removed XPASS test

* Fix for issue #110
@smolkaj
Copy link
Member Author

smolkaj commented Oct 20, 2016

Amazing, that was fast :)
Concatenation is useful in porting the switch.p4 parser to P4-16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants