]> git.phdru.name Git - phdru.name/cgi-bin/blog-ru/search-tags.git/blobdiff - parser/grammar
Use grako instead of PLY to compile EBNF to Python
[phdru.name/cgi-bin/blog-ru/search-tags.git] / parser / grammar
diff --git a/parser/grammar b/parser/grammar
deleted file mode 100644 (file)
index 14753c8..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-# Grammar rules for tag searching; BNF.
-
-# The grammar defines expressions in the following forms:
-#  TAG - search blog posts that contain the tag;
-#  !TAG - search blog posts that don't contain the tag;
-#  TAG & TAG - search blog posts that contain both tags;
-#  TAG | TAG - search blog posts that contain any of the tags;
-# Parentheses are allowed to group expressions; for example:
-#  TAG & (TAG | TAG)
-#  !(TAG | TAG)
-# Allowed operators: conjunction - & && AND and
-#                    disjunction - | || OR or
-#                    negation    - ! NOT not
-# This  is a simple version of the grammar and it allows
-# rather stupid expressions, like !!TAG or ((TAG)); in the future
-# it will be fixed by making the grammar more complex and stricter.
-
-NAME : '[a-z][a-z0-9_]+'
-
-AND_OP : '&'
-
-OR_OP : '|'
-
-NOT_OP : '!'
-
-SP1 : '[ \t]+'
-
-expression : NAME
-           | expression SP0 AND_OP AND_OP SP0 expression
-           | expression SP0 AND_OP SP0 expression
-           | l_expression and_word r_expression
-           | expression SP0 OR_OP OR_OP SP0 expression
-           | expression SP0 OR_OP SP0 expression
-           | l_expression or_word r_expression
-           | NOT_OP SP0 expression
-           | not_word r_expression
-           | expression_parens
-
-l_expression : expression_parens
-             | expression_sp
-
-r_expression : expression_parens
-             | sp_expression
-
-expression_parens : '(' SP0 expression SP0 ')'
-
-sp_expression : SP1 expression
-
-expression_sp : expression SP1
-
-and_word : 'A' 'N' 'D'
-         | 'a' 'n' 'd'
-
-or_word : 'O' 'R'
-        | 'o' 'r'
-
-not_word : 'N' 'O' 'T'
-         | 'n' 'o' 't'
-
-SP0 : SP1 | empty
-
-empty :