Added SyaNodeParser (finally, after one month)

This commit is contained in:
2020-04-09 15:42:36 +02:00
parent c9acfa99a1
commit 6c7c529016
56 changed files with 5322 additions and 404 deletions
+5 -5
View File
@@ -659,7 +659,7 @@ For the two questions, I will first try the simple implementations and see there
Going back on BNF implementation. As it's Christmas eve today, I won't stay very long.
So, the implementation lies in the class ConceptLexerParser, a it's a lexer not for token, but for concept.
So, the implementation lies in the class BnfNodeParser, a it's a lexer not for token, but for concept.
The purpose of this class is to recognize a sequence of Concept.
So if we defines the following concepts
@@ -675,7 +675,7 @@ when you input
one two three four five
the list of :code:`[foo, bar]` will be returned by the ConceptLexerParser (as return values)
the list of :code:`[foo, bar]` will be returned by the BnfNodeParser (as return values)
How does it works ?
@@ -696,7 +696,7 @@ Some example :
and so on...
So when a concept is defined using its bnf definition, I use the **BnfParser** to create the grammar, and then
I use the **ConceptLexerParser** to recognize the concepts
I use the **BnfNodeParser** to recognize the concepts
The current implementation to recognize a concept is not very efficient. All the definitions are in a dictionary
and I go thru the whole dictionary to see if some concepts are recognized. Once a concept is found, I loop again
@@ -713,7 +713,7 @@ So once the parsing is effective, I return a **ConceptNode** object
class ConceptNode(LexerNode):
"""
Returned by the ConceptLexerParser
Returned by the BnfNodeParser
It represents a recognized concept
"""
@@ -859,7 +859,7 @@ As of now, I have implemented the following parsers:
* DefaultParser (the name is not accurate)
To recognize builtin syntax (like 'def concept' or 'isa')
* ConceptLexerParser
* BnfNodeParser
To recognize concept defined with BNF language
All theses parsers are executed in the row (the order in not very important)