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

changed Always to inheret from StructuralStatement #5

Merged
merged 3 commits into from
Jun 18, 2019
Merged

Conversation

rdaly525
Copy link
Collaborator

The always block itself is a structural statement (in my opinion). I do not think we need to treat it differently than other structural statements. This also simplifies the AST slightly.

@rdaly525 rdaly525 requested a review from leonardt June 18, 2019 21:02
@rdaly525 rdaly525 mentioned this pull request Jun 18, 2019
@@ -200,8 +200,7 @@ std::string Module::toString() {
// emit body
for (auto statement : body) {
module_str +=
variant_to_string<Always *, StructuralStatement *, Declaration *>(
statement) +
variant_to_string<StructuralStatement *, Declaration *>(statement) +
";\n";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When generating the string for a module, the ; are inserted after every statement, so Declaration/Assign shouldn't generate the semicolon to be consistent, or this semicolon should be removed

@@ -259,7 +258,7 @@ std::string Always::toString() {
for (auto statement : body) {
always_str +=
variant_to_string<BehavioralStatement *, Declaration *>(statement) +
";\n";
"\n";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, the logic for generating the body of an always block is inconsistent with the logic for a module definition, we should use the same pattern for both (either everyone generates their own semicolon, or the enclosing construct adds the semicolons)

Copy link
Owner

@leonardt leonardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing Always to be Structural makes sense, although Structural might not be the best name. Really what we want are a class of statements that are legal to put inside a module definition body (that is, behavioral statements must be inside an always block, whereas other statements must be inside a module definition). I feel like ModuleDefinitionStatement would be the most explicit/correct name, but that seems verbose.

Regardless, we can leave it as structural statement for now, but there's inconsistencies with how statements/semicolons are handled that should be resolved before merging.

Copy link
Owner

@leonardt leonardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@leonardt leonardt merged commit e38efbf into master Jun 18, 2019
@leonardt leonardt deleted the always branch June 18, 2019 23:44
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.

None yet

2 participants