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

Added ebnf.md file #1987

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions v0.5/p1/spec/EBNF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# EBNF

```chatinput
<fastn> ::= <comment>* <module_comment>? <item>*
<item> ::= <comment> | <section>


<module_comment> ::= (<single_module_comment> <new_line>)* <single_module_comment> (<new_line> | <eof>)
Copy link
Contributor

@amitu amitu Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<module_comment> ::= (<single_module_comment> <new_line>)* <single_module_comment> (<new_line> | <eof>)
<module_comment> ::= (<single_module_comment> <new_line>)* (<single_module_comment> <eof>)?

Would this be same / simpler?

Would this work?

Suggested change
<module_comment> ::= (<single_module_comment> <new_line>)* <single_module_comment> (<new_line> | <eof>)
<module_comment> ::= (<single_module_comment> (<new_line> | <eof>))*

<single_module_comment> ::= <doc_comment_marker> <opt_whitespace> <sentence>? <opt_whitespace>
Copy link
Contributor

@amitu amitu Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<single_module_comment> ::= <doc_comment_marker> <opt_whitespace> <sentence>? <opt_whitespace>
<single_module_comment> ::= <doc_comment_marker> <space>* <sentence>? <space>*

Should we have opt_whitespace?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include the <newline> | <eof> here only? And rename this to <module_comment_line>?


<comment> ::= (<single_comment> <new_line>)* <single_comment> (<new_line> | <eof>)
<single_comment> ::= <comment_marker> <opt_whitespace> <sentence>? <opt_whitespace>


<section> ::= <start_marker> <opt_whitespace> <section_declaration>? <new_line>?
<section_declaration> ::= (<section_kind> <whitespace>)? <section_name> <colon> <opt_whitespace> <section_value>? <opt_whitespace>
<section_kind> ::= <word>
<section_name> ::= <word>
<section_value> ::= <word>



<start_marker> ::= "--"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this to section_start_marker. Should we include the space here itself as that is required part of our syntax we just discussed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think the grammar would be easier to read if we do not define names for things that are ever used once.

<end_marker> ::= "--" <whitespace> "end:" <opt_whitespace>
<new_line> ::= "\n"
<eof> ::= "\n"
<colon> ::= ":"
<comment_marker> ::= ";;"
<doc_comment_marker> ::= ";;;"

<sentence> ::= <word> <opt_whitespace> | <word>
<opt_whitespace> ::= " "*
<whitespace> ::= " "+
<word> ::= <character>+
<character> ::= <letter> | <digit>
<letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"
<digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
```
2 changes: 2 additions & 0 deletions v0.5/p1/t/01-comment.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; This is comment
;; This is other line in comment
10 changes: 10 additions & 0 deletions v0.5/p1/t/01-comment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"type": "comment",
"source": {
"from": "1:0",
"to": "2:33",
"value": " This is comment\nThis is other line in comment"
}
}
]
Loading