P4ELTE / t4p4s

Retargetable compiler for the P4 language
http://p4.elte.hu/
Apache License 2.0
119 stars 42 forks source link

P4 to C compilation fails with syntax error #26

Closed MarcusWichelmann closed 3 years ago

MarcusWichelmann commented 3 years ago

Hi,

I tried running the examples and got the following error:

root@ddos-test:~/t4p4s# ./t4p4s.sh ./examples/l2fwd-gen.p4 
[COMPILE  P4-16] ./examples/l2fwd-gen.p4 @std
Traceback (most recent call last):
  File "src/compiler.py", line 8, in <module>
    from hlir16.hlir import *
  File "/root/t4p4s/src/hlir16/hlir.py", line 14, in <module>
    from hlir16.p4node import P4Node
  File "/root/t4p4s/src/hlir16/p4node.py", line 115
    return ((key, subnode) for key in node if (subnode := node[key]) not in founds)
                                                       ^
SyntaxError: invalid syntax

Error: P4 to C compilation failed (error code: 1)

Any idea?

scholzd commented 3 years ago

Assignment expressions are a new feature in python 3.8 (https://www.python.org/downloads/release/python-380/). You probably need to upgrade your python version if you want to use any of the hlir16 commits using this new syntax.

Best regards.

MarcusWichelmann commented 3 years ago

Thank you, it works with Python 3.9. 👍🏼