objectionary / eo

EOLANG, an Experimental Pure Object-Oriented Programming Language Based on 𝜑-calculus
https://www.eolang.org
MIT License
955 stars 124 forks source link

Rewrite syntax EBNF #2399

Closed maxonfjvipon closed 10 months ago

maxonfjvipon commented 11 months ago

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 commented 11 months ago

@Graur please set Urgent milestone to it

yegor256 commented 11 months ago

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

maxonfjvipon commented 11 months ago

@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 commented 11 months ago

@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 commented 11 months ago

@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 commented 11 months ago

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

0pdd commented 10 months ago

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

0pdd commented 10 months ago

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

0pdd commented 10 months ago

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

0pdd commented 6 months ago

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