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

Rewrite syntax EBNF #2399

Closed
maxonfjvipon opened this issue Aug 16, 2023 · 10 comments · Fixed by #2474
Closed

Rewrite syntax EBNF #2399

maxonfjvipon opened this issue Aug 16, 2023 · 10 comments · Fixed by #2474
Assignees
Labels
Milestone

Comments

@maxonfjvipon
Copy link
Member

maxonfjvipon commented Aug 16, 2023

Current syntax EBNF is quite poor and "weak". There are not enough structure blocks to resolve almost all our syntax errors: #415, #1468, #1469, #1841, #2291, #2320, #2321.
Need to rewrite it and make stricter

@maxonfjvipon maxonfjvipon self-assigned this Aug 16, 2023
@maxonfjvipon
Copy link
Member Author

@Graur please set Urgent milestone to it

@maxonfjvipon maxonfjvipon changed the title Rewrite syntax BNF Rewrite syntax EBNF Aug 16, 2023
@Graur Graur added this to the Urgent milestone Aug 16, 2023
@yegor256
Copy link
Member

@maxonfjvipon I didn't understand the problem described here. What exactly is wrong? You are talking about Program.g4 file?

@maxonfjvipon
Copy link
Member Author

maxonfjvipon commented Aug 16, 2023

@yegor256 yes, about Program.g4 where EBNF is described (if I'm not mistaken in terms). Current amount and structure of key syntax blocks (like head, application, htail) don't allow us to resolve all of above syntax bugs by small changes and fixes (I tried) because there's a mess in there. I'm sure that current grammar allows us to write much invalid code, we just haven't come across such examples yet.
I strongly believe that we should make a kind of breakthrough change - rewrite the grammar, make it fuller, wider and from the very beginning to put a solution of all bugs above there

@yegor256
Copy link
Member

@maxonfjvipon sounds like a good intent, but I'm not sure it's possible to just "make it better" :) You are more than welcome to try.

@maxonfjvipon
Copy link
Member Author

maxonfjvipon commented Aug 17, 2023

@yegor256 image this code:

[name] > cat
  name > @

* cat > cats

stdout > @
  cats.at 0
    "Lisa"

With current grammar this code is valid but it does not work.

  1. I understand it like: "get cat by 0 index (application of tuple.at firstly) -> set name to "Lisa"(application of cat secondly)"
  2. Compiler understands it like: "application of tuple.at with two arguments - 0 and "Lisa""

So there's a conflict of vertical and horizontal applications. I believe this code should be invalid on the level of grammar, means we should not allow to mix horizontal and vertical applications at all, even with braces, so this should be not valid too:

(cats.at 0)
  "Lisa"

What do you think?

@yegor256
Copy link
Member

@maxonfjvipon this issue does make sense (the one about vertical-vs-horizontal notation), but it should be in a new ticket

maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 5, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 6, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 6, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 6, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Sep 6, 2023
@0pdd
Copy link

0pdd commented Sep 8, 2023

@maxonfjvipon 3 puzzles #2482, #2483, #2484 are still not solved.

@0pdd
Copy link

0pdd commented Sep 11, 2023

@maxonfjvipon 2 puzzles #2483, #2484 are still not solved; solved: #2482.

@0pdd
Copy link

0pdd commented Sep 18, 2023

@maxonfjvipon the puzzle #2483 is still not solved; solved: #2482, #2484.

@0pdd
Copy link

0pdd commented Dec 28, 2023

@maxonfjvipon all 3 puzzles are solved here: #2482, #2483, #2484.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants