Description
Hi,
[1] Comments
is there any reason why comments aren't treated as white-space and are as things stand, included in the AST?
I know that doc-comments are used somewhere, however cant we just get it from the CST then? Or at least exclude comments in the AST.
[2] Operators
operator ::= '=' | ',' | ':' | ';' | '(' | ')' | '{' | '}' | '<' | '>' | '*' | '->'
-
I don't understand why are these operators grouped together, and why is
()
,<>
,,
,{}
,;
,->
operators?
The only things that could could qualify as an operator here are assignment operators=
and possibly:
. What is an operator in this context? -
What is
*
? If we havetuple<>
[3] Reserved Keywords
- Is there any reason we are hard-coding builtin types as reserved types in the grammar, shouldn't that be up to a validator?
- Why is the keyword
as
treated as reserved. How its used allows it to be used as an identifier
[4] Types
- Is there any reason we are hard-coding builtin types into the grammar? Is there any hard-coded type with a different format than simply being an
id
? I don't think so? Actually, I don't know if the types with generic parameters are hard-coded yet, Option, Tuple, Record, List. However other than that none? Consider it in the context of an AST, do we need to explicitly state that a type is for example u32, Any benefit of doing so in the AST?
These builtin types are fine placed elsewhere, outside the grammar.
- Shouldn't unit being
_
be its own type? As it stands we can't define a unit type outside a result.
I was going to open PR, however I thought it would've been appropriate to raise an issue first.
I'm not an expert of any kind in (E)BNF nor do I have experience writing an (E)BNF, so do feel free to correct me if I'm wrong.
Thank you