Skip to content

PCL: Add some semantically erroroneous programs#119

Merged
kostis merged 1 commit intokostis:masterfrom
souvlakias:pcl-semantic-erroneous-programs
Apr 16, 2026
Merged

PCL: Add some semantically erroroneous programs#119
kostis merged 1 commit intokostis:masterfrom
souvlakias:pcl-semantic-erroneous-programs

Conversation

@souvlakias
Copy link
Copy Markdown
Contributor

@souvlakias souvlakias commented Apr 15, 2026

Adds a few more semantically erroneous programs that are grammatically correct. Follows the structure and naming of other examples (semantic_error_<i>.pcl)

Coverage

Labels:

  • Illegal cross scope goto
  • goto to a declared but undefined label

Functions & Procedures:

  • Usage of result keyword in non-function blocks
  • Inconsistency between forward and actual header declarations
  • Assignment from a procedure call
  • Passing a constant or expression to a var argument (l-value expected)

Misc:

  • Dereference of nil

@souvlakias
Copy link
Copy Markdown
Contributor Author

souvlakias commented Apr 15, 2026

Usage of result keyword in non-function blocks

This I'm not so sure about since some lexical erroneous programs (e.g.) do use it, but are just marked as lexical errors.
It's not formally defined in the pdf, but I think what makes sense is that it should only exist in functions' main blocks. So, If you want, I can change/fix the lexical erroneous examples to not have this semantic error

@kostis
Copy link
Copy Markdown
Owner

kostis commented Apr 16, 2026

This I'm not so sure about since some lexical erroneous programs (e.g.) do use it, but are just marked as lexical errors.

It's a bit unclear what you are concerned about. The program you mention is lexically erroneous because it contains a stray $ character, so it should be rejected early by the lexer, and never reach the semantic analysis pass of a (correct) PCL compiler. So, whether the result keyword is used correctly or not in that program is irrelevant (a non-issue).

If I have misunderstood your concern, feel free to comment again.

@souvlakias
Copy link
Copy Markdown
Contributor Author

So, whether the result keyword is used correctly or not in that program is irrelevant (a non-issue).

Yes, you are right. All good then, sorry for the confusion 😅

@kostis
Copy link
Copy Markdown
Owner

kostis commented Apr 16, 2026

Thanks for your contribution. I am merging this.

@kostis kostis merged commit bd4a368 into kostis:master Apr 16, 2026
2 checks passed
@souvlakias souvlakias deleted the pcl-semantic-erroneous-programs branch April 17, 2026 00:24
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.

2 participants