emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/bnf-mode 6aa0bcf 09/43: Add sample EBNF syntax for futu


From: Stefan Monnier
Subject: [elpa] externals/bnf-mode 6aa0bcf 09/43: Add sample EBNF syntax for future testing and references
Date: Mon, 20 Jan 2020 13:39:00 -0500 (EST)

branch: externals/bnf-mode
commit 6aa0bcfec690a5067e29f08d05175b0fc6129f92
Author: Serghei Iakovlev <address@hidden>
Commit: Serghei Iakovlev <address@hidden>

    Add sample EBNF syntax for future testing and references
---
 test/ebnf-grammar.ebnf | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/test/ebnf-grammar.ebnf b/test/ebnf-grammar.ebnf
new file mode 100644
index 0000000..b8e8f20
--- /dev/null
+++ b/test/ebnf-grammar.ebnf
@@ -0,0 +1,68 @@
+(*  This example defines Extended BNF informally.  Many of the syntax
+rules include a comment to explain their meaning; inside a comment a
+meta identifier is enclosed in angle brackets  <  and  >  to avoid
+confusion with similar English words.  The non-terminal symbols
+<letter>, <decimal_digit> and <character> are NOT defined.  The position
+of <comments> is stated in a comment but not formally defined.  *)
+
+(*  A <syntax_rule> defines the sequences of symbols represented by a
+<meta_identifier>  *)
+syntax = syntax_rule, { syntax_rule } ;
+syntax_rule = meta_identifier, '=', definitions_list, ';' ;
+
+(*  |  separates alternative <single_definitions>  *)
+definitions_list = single_definition, { '|', single_definition } ;
+
+(* ,  separates successive <terms>  *)
+single_definition = term, { ',', term } ;
+
+(*  A <term> represents any sequence of symbols that is defined by the
+<factor> but not defined by the <exception>  *)
+term = factor, ['-', exception] ;
+
+(*  A <factor> may be used as an <exception> if it could be replaced by
+a <factor> containing no <meta_identifiers>  *)
+exception =  factor;
+
+(*  The <integer> specifies the number of repetitions of the
+<primary>  *)
+factor = [ integer, '*' ], primary ;
+
+primary = optional_sequence | repeated_sequence | special_sequence
+          | grouped_sequence | meta_identifier | terminal_string
+          | empty ;
+
+empty = ;
+
+(*  The brackets  [  and  ]  enclose symbols which are optional  *)
+optional_sequence = '[', definitions_list, ']' ;
+
+(*  The brackets  {  and  }  enclose symbols which may be repeated any
+number of times  *)
+repeated_sequence = '{', definitions_list, '}' ;
+
+(*  The brackets  (  and  )  allow any <definitions_list> to be a
+<primary>  *)
+grouped_sequence = '(', definitions_list, ')' ;
+
+(*  A <terminal_string> represents the <characters> between the quote
+symbols '_'  or  "_"  *)
+terminal_string = "'", character - "'", { character - "'" }, "'"
+                  | '"', character - '"', { character - '"' }, '"' ;
+
+(*  A <meta_identifier> is the name of a syntactic element of the
+language being defined  *)
+meta_identifier = letter, { letter | decimal_digit } ;
+
+integer = decimal_digit, { decimal_digit } ;
+
+(*  The meaning of a <special_sequence> is not defined in the standard
+metalanguage.  *)
+special_sequence = '?', { character - '?' }, '?' ;
+
+(*  A comment is allowed anywhere outside a <terminal_string>,
+<meta_identifier>, <integer> or <special_sequence>  *)
+comment = '(*', { comment_symbol }, '*)' ;
+
+comment_symbol = comment | terminal_string | special_sequence
+                 | character ;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]