unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

Documentation Error regarding "." as operator vs. part of name #3517

Open kylegoetz opened 2 years ago

kylegoetz commented 2 years ago

In the documentation, the rules for deciding whether "." is part of a name (dividing name segments) versus an operator say (https://www.unison-lang.org/learn/language-reference/identifiers/):

. by itself is always an operator.

However, in the source code itself (https://github.com/unisonweb/unison/blob/trunk/unison-core/src/Unison/Name.hs)

-- A few example names: [snip] "." --> Name Relative ["."]

Under the documentation, "." should be an operator. However, the source code explicitly states "." is a relative name rather than an operator.

Which is correct? I'm writing a tree sitter grammar for IDEs that use tree sitter grammars for parsing/syntax highlighting/code suggestions.

(Side note, is there a formal grammar specification somewhere? Right now I'm reduced to reading the Haskell source to understand the documentation I've found better and trying to figure things out, but it's very slow going.)

mabasic commented 1 year ago

@kylegoetz How is your progress on this?

aryairani commented 8 months ago

@kylegoetz Name.hs has changed a bunch now, could you take another look and see if it impacts or changes your question, feel free to grab me on Discord too if that helps.