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

Merge progress on SuperP4 #165

Draft
wants to merge 94 commits into
base: master
Choose a base branch
from
Draft

Merge progress on SuperP4 #165

wants to merge 94 commits into from

Conversation

paulgazz
Copy link
Member

@paulgazz paulgazz commented Feb 3, 2022

No description provided.

fattaholmanan and others added 30 commits May 20, 2021 00:34
big push includes initial code that parses and generates call graphs for specific P4 grammar constructs and support to export dot files. Also modified parser so that function calls under the expression grammar is now separated into a new grammar value.
… addToScope to reuse existing entity

addToScope now checks if the name is present under the current scope and returns that entity so that we do not create a new entity for that name. New entity is created and added to the symtab if it doesn't exist.
Right now only builds up the definitions, yet to rebuild call graph and type checker
A lot of repeated code in call graph generation dispatcher to implement scoping. Need to refactor that
actionList is tagged as list, so wraps inside constructs with conditionals, so have a helper function to deal with that
separating actionList into two constructs and updating call graph generator to reflect that
…call graph

separating out assignment and method call constructs in the parser for easier identification in the call graph generation. Plus now lvalue is supported in call graph generation with a single assertion that method calls' lvalue only contain name and no dot values. Still yet to assert that lvalues called under assignment are only of the three constructs mentioned in comments
Invoking regular expressions and non brace expressionswq
…onditional nodes

extern function declarations are invokable constructs as per the language specs, so keeping track of that in the symbol table so that future invocations don't fail. Plus handling conditional nodes where we skip empty conditional nodes when present and get the children
between callees and definitions
… differentiate generated generic function with same return types in before and after
…side them to simplify generateInstance function

Changing externfunctiondeclaration and functiondeclaration to extend respective functionPrototype class (either regular or generator class) so that it inherits function prototype logic since both the constructs are more or less just the function prototype. Added helper function to create the new parent or sub class objects.
Function prototype was not converted to a generator function when the return value wasn't of generic type and no new optTypeParameters were passed in. If the type parameter was passed in through a parent construct - like extern declaration - then function prototype remained normal class. Fixed that by checking if any parameter is of generic type. Algorithm can be optimized
Uncaught error; P4 language allows preprocessor usage to have multi-lines when the first line is ended with a backslash, like in Python. Adding support and a test case for that since p4_16_samples does not have a related test case
One case not supported yet as it looks like it needs a considerable amount of change - checkout test case CGTest_generic_struct_nested_inside_header.p4 Assert statements have been included to make sure those cases don't silently fail
Handling of generics had a big bug - so refactored the code to handle generics better. Now when resolving generic constructs we go through the AST again for the body of the construct we are resolving generics for. Required more values to be passed and hence the change. Plus updating test cases
Previously when there are multiple subparsers and all of them have an error in it (parse error when the file has preprocessor usages). So this change quits if all subparsers have an error - but still not complete yet as error thrown when all subparsers are in the ERROR state needs to be handled
Backwards support for pragma not mentioned in P4 language specification document but in P4C lexer. Was used in other projects so had to support it. And was using EnterScope for some productions where ReenterScope was supposed to be used; fixed it.
…e test cases.

Adding support for multiple function and method declarations that have different number of parameters. NOTE: P4 allows function and method overloading where they can have same number of parameters as long as the parameters have different names - current commit does not support that yet, just different number of parameters.
Also fixing a good amount of bugs. Still need to update test cases
E.g. typedefs can shadow a variable in a problem. A new value can shadow any other value
…ctions

There are cases when a P4 program invokes the package/switch multiple times with different configurations (there might be two parsers defined for example, and one switch/package uses parser A while another uses parser B). So adding support so that macro usage output will be displayed for any package or switch declaration that matches the passed in template (the -preprocessorUsageMatrix -templateFileForMatrix flags).
It is needed to make the call graph visuals
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

Successfully merging this pull request may close these issues.

3 participants