Add basic symbol table functionality (towards #201)#293
Conversation
Codecov Report
@@ Coverage Diff @@
## master #293 +/- ##
==========================================
+ Coverage 90.95% 91.09% +0.13%
==========================================
Files 35 36 +1
Lines 12917 13107 +190
==========================================
+ Hits 11749 11940 +191
+ Misses 1168 1167 -1
Continue to review full report at Codecov.
|
|
Hi @rupertford, this isn't finished yet but would you mind having a glance over it just to confirm you're happy with the direction? |
Hi @arporter. It looks great. I really like the scoping, symbol tables singleton and symbol table hierarchy. My only comments/questions are
|
|
re. your question 6., not unless we want only the top-level symbol tables to by stored in |
Yes, that is what I was wondering. If we store the tables in a hierarchy and don't have a dictionary lookup then we would not need a "full name". |
…p-level symbol tables into it.
|
re. your question/comment 5. I think it would be possible to silently ignore the symbol table functionality if ever |
…e requested Fortran standard
|
This is now ready for a proper review. Note that although use statements are captured, any symbols named in 'only' clauses are not currently captured as symbols. Probably we will need a class to represent Symbols and this could have a |
rupertford
left a comment
There was a problem hiding this comment.
This is a really nice implementation of a key piece of functionality. There are lots of comments (sorry) but only a few major issues/questions 1) what about programs without the program keyword, 2) what about the robustness of creating a symbol table (might we need to remove one if there is not match in BlockBase and 3) should different symbol types be added and stored in different lists/dictionaries, or in one place.
|
This is ready for another look now @rupertford. |
rupertford
left a comment
There was a problem hiding this comment.
All issues have been addressed. However, the diff coverage is not 100%. Could you please take a look and add appropriate tests if possible.
|
I'm not sure what to do about one of the diff coverage problems (L595-596 in utils.py) - it is code that I've touched in that I've now surrounded that block of code with a |
|
In running this branch on the NEMOVAR code base I discovered an error that occurs when trying to remove a symbol table after a syntax error has occurred - I was only looking at the list of top-level tables and not looking within the current scope. I've updated the code to do this and now I think all syntax errors are related to overridden intrinsics. |
|
OK, ready for another round. I've decided I don't understand the BlockBase.match() method but have succeeded in removing a couple of flags that don't appear to do anything useful. I've tested with NEMO and NEMOVAR and it all seems fine. That said, I'll try using PSyclone with this version of fparser and see what happens. |
|
I can confirm that I can process and then compile NEMO using this version of fparser and master of PSyclone. |
rupertford
left a comment
There was a problem hiding this comment.
All issues have been addressed. I took the liberty of fixing a typo and a missing copyright date update. This is a significant new piece of functionality. It's all very exciting.
No description provided.