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

Block statements are missing from ASTs #362

Closed
anton-trunov opened this issue May 25, 2024 · 3 comments · Fixed by #1334
Closed

Block statements are missing from ASTs #362

anton-trunov opened this issue May 25, 2024 · 3 comments · Fixed by #1334
Assignees
Labels
ast bug Something isn't working or isn't right language feature scope: parser
Milestone

Comments

@anton-trunov
Copy link
Member

Block statements are a part of the Tact grammar but those are not processed when converting Ohm.js's CSTs to ASTs.

Hence this code snippet

fun foo() {
    {
        // I'm a block statement
        let x: Int = 42;
    }
}

results in the following error message:

Missing semantic action for 'StatementBlock' in operation 'resolve_statement'. 
Action stack (most recent call last): 
  resolve_program > Program 
  resolve_program_item > default action for 'ProgramItem' 
  resolve_program_item > StaticFunction 
  resolve_declaration > default action for 'Function' 
  resolve_declaration > Function_withVoid 
  resolve_statement > default action for 'Statement' 
  resolve_statement > StatementBlock 
@anton-trunov anton-trunov added bug Something isn't working or isn't right scope: parser labels May 25, 2024
@anton-trunov anton-trunov added this to the v1.3.1 milestone May 25, 2024
@Gusarich
Copy link
Member

Actually they're not just missing from AST, they aren't implemented in Tact at all.
I've just tried adding them but seems that handling variable scoping there isn't trivial so I suggest to move it from 1.3.1 to 1.4.0 instead.

@anton-trunov
Copy link
Member Author

Agreed, let's move it to 1.4.0

@anton-trunov anton-trunov modified the milestones: v1.3.1, v1.4.0 May 29, 2024
@anton-trunov anton-trunov modified the milestones: v1.4.0, v1.5.0 Jun 12, 2024
@anton-trunov anton-trunov self-assigned this Jul 26, 2024
@anton-trunov anton-trunov modified the milestones: v1.5.0, v1.6.0 Sep 15, 2024
@i582 i582 assigned i582 and unassigned anton-trunov Jan 14, 2025
@verytactical
Copy link
Contributor

FYI there are grammar/prev/grammar.ts and grammar/next/index.ts, and BlockStatements should be generate with either of them.

i582 added a commit that referenced this issue Jan 14, 2025
i582 added a commit that referenced this issue Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast bug Something isn't working or isn't right language feature scope: parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants