Add dependency graph functionality#1
Conversation
Changes: - SandScout Compiler can now return the rules it discovers as a dictionary of lists. - When the script is imported, only the dictionary output is supported. - When called directly, the script uses argparse to be more verbose about its parameters. - Converted the script to Python3 - Improved coding style consistency. - Increased tab size to 4 spaces. - TODOs still present from before.
razvand
left a comment
There was a problem hiding this comment.
Thanks for doing this. Please address my comments that mostly deal with the old version of the code. But, as long as you worked on it, it makes sense to improve it further.
| _GRAPH = {} | ||
| _CMD_ARGS = None | ||
|
|
||
| # Regular expression rules for simple tokens |
There was a problem hiding this comment.
These expressions are not used in the program.
There was a problem hiding this comment.
They are. ply requires a set of tokens that it tries to match against the input file. They are declared in the tokens list above
|
|
||
|
|
||
| def main(): | ||
| _get_args() |
There was a problem hiding this comment.
Why is this using and underscore prefix? Is there a Python naming convention for this?
There was a problem hiding this comment.
Yes. They're somewhat similar to static functions in C. If someone were to from sandscout_compiler import * [1], symbols starting with _ would not be visible. However, when importing the file like this import sandscout_compiler, all symbols, regardless of names, would be imported.
[1] https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles
Changes: - Fix all pycodestyle errors and those pylint errors that don't affect the functionality of the code - Add docstrings to all functions and to the script itself - Replace camelCase with snake_case
The output of the SandScout compiler differed in certain aspects from that of SandBlaster. Now those differences have been eliminated.
Changes: