-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enable JSON ASTs when 4th grammar section detected #96
Conversation
@reedeveris @reedeveris the build in CI has been fixed, and this branch has been synch'd. |
Tentative to do:
|
As of now, plcc successfully detects the fourth section, and creates the Python directory, all automated based on whether the third section ends in a '%'. For @StoneyJackson 's attention: |
Note for next meeting:
|
@reedeveris @AksharP5 Please read #52 (comment) |
When plcc.py processes a 4-section grammar, it will generate both Java and Python code. The Java code needs to include the ParseJsonAST.java file. Right now I think that's done by passing a --json_ast to plcc.py. We should change it so that it is done automatically if there is a 4th section. I think all we should do in this PR is:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tried running this. But here is some feedback.
src/plcc.py
Outdated
if len(line) == 0 or line[0] == '#': | ||
# skip just comments or blank lines | ||
continue | ||
if line == '%': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this on both line 945 and line 950?
src/plcc.py
Outdated
sempyFinishUp() | ||
for line in nxt: | ||
line = line.strip() | ||
if line[:7] == 'include': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not going to allow the classic 'include' in the new 4th section. So let's remove this section.
tests/plcc/compiles-obj/OBJ/grammar
Outdated
@@ -157,3 +157,4 @@ include val | |||
include list | |||
include class | |||
include ref | |||
% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should leave this alone as it tests a traditional 3-section grammar. If you modify this, then we don't know if your changes break what was working before.
Instead, we need a separate test for a 4-section grammar. You could copy "compiles-obj" to something like "compiles-4-section-grammar", and then make this change.
I see that there are updates. Excellent! I probably won't have a chance to look at them until Wednesday morning. So, if you are at the limits of what you can do in code without decisions from me, and you have more cycles for work, you can do some planning (next steps), design (Is there a design that would have made what you just did easer? Are the names the best they could be? How will the next step fit in with what you just did?), testing (write a test that passes when your new stuff works and fails when it doesn't), and/or documentation (how should README.md be updated to reflect the changes you just made). |
Update:
|
Create test cases:
|
This is in anticipation of a new hybrid Java/Python mode in which the parser runs in Java and the semantics rep-loop runs in Python. In this commit, when an optional 4th section is detected, plcc.py generates ParseJsonAst.json. Thus allowing the parser to to generate JSON ASTs when the `--json_ast` flag is passed. It also generates experimental Python files. --- Closes #95 Co-authored-by: Reed Everis <[email protected]> Co-authored-by: Akshar Patel <[email protected]> Co-authored-by: Stoney Jackson <[email protected]>
13fa0f7
to
7cecc65
Compare
Template for Final Squash Commit Message