-
Notifications
You must be signed in to change notification settings - Fork 171
Open
Labels
enhancementlistsConcerning list categories and separator/terminator/delimiter pragmasConcerning list categories and separator/terminator/delimiter pragmas
Milestone
Description
We would like the following aspects supported by a feature that allows us to define lists:
- Concerning even AST:
- several list categories for one category
- non-empty vs. possibly empty lists
- snoc (left associative) vs. cons (right associative) lists
- Concerning parsing:
- delimiters (markers for begin and end)
- separators (infix) vs. terminators (postfix) vs. "initiators" (prefix symbol, like bullet lists)
- Concerning printing:
- horizontal vs. vertical (currently only for ";" separator/terminator)
A possible grammar for a new list pragma could be:
ListPragma. Def ::= "#list" Ident "of" Ident [ListAttribute] ;
ListAttribute
::= "non-empty"
| "snoc" | "cons"
| "horizontal" | "vertical"
| "open" String
| "close" String
| {"prefix"|"postfix"}? "separator" String | "terminator" String | "initiator" String
Attributes listed on the same line are mutually exclusive.
How to print vertical lists?
separator-post = [
a,
b,
c ]
separator-pre =
[ a
, b
, c
]
separator-pre-without-delimiters =
a
+ b
+ c
terminator = {
a;
b;
c;
}
initiator = begin
- a
- b
- c
end
The current automatic parsing of cons lists as snoc lists #163 would be removed, is anyway just a buggy optimization.
See also #106 for the delimiters syntax.
ScottFreeCode
Metadata
Metadata
Assignees
Labels
enhancementlistsConcerning list categories and separator/terminator/delimiter pragmasConcerning list categories and separator/terminator/delimiter pragmas