2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit fd01fd31 authored by di68kap's avatar di68kap
Browse files

- EXPERIMENTELLER Debugging-Code für den Aufrufer-Stapel der Parser in der...

- EXPERIMENTELLER Debugging-Code für den Aufrufer-Stapel der Parser in der left_recursion_guard()-Funktion.
- Refactoring, u.a. ParserRoot -> ParserHeadquarter
- compilierungsscripte für a) MLW-Grammatik b) MLW-Einträge mit dieser Grammatik
- Grammatik für MLW erweitert und Beispiel "facitergula.mlw" ausgebaut.
parent bd69138e
This diff is collapsed.
* Fehler im Required-Operator!?
* finally split ParserCombinators.py into different modules, like:
SyntaxTree, ErrorMessages, ParserCombinators, ASTTransform, EBNFCompiler, DSLCompiler
......@@ -6,7 +6,7 @@
Artikel = [LEER]
§LemmaPosition [ArtikelKopf] §BedeutungsPosition
§LemmaPosition [ArtikelKopf] §BedeutungsPosition §Autorinfo
[LEER] DATEI_ENDE
......@@ -37,7 +37,7 @@ GrammatikVarianten = "(" §GVariante { ";" §GVariante } §")"
GVariante = Flexionen [_genus] ":" Beleg
Flexionen = Flexion { "," §Flexion }
Flexion = /-*[a-z]+/~
Flexion = /-?[a-z]+/~
_genus = "maskulinum" | "m." |
"femininum" | "f." |
......@@ -48,28 +48,33 @@ _genus = "maskulinum" | "m." |
#### ARTIKEL-KOPF ############################################################
ArtikelKopf = SchreibweisenPosition
SchreibweisenPosition = { "SCHREIBWEISE" §SWTyp ":" §SWVariante { "," §SWVariante} }
SWTyp = "script."
SchreibweisenPosition = "SCHREIBWEISE" §SWTyp ":" §SWVariante { "," §SWVariante}
SWTyp = "script." | "script. fat-"
SWVariante = Schreibweise ":" Beleg
Schreibweise = "vizreg-" | "festregel(a)" | "fezdregel(a)" | "fat-"
Beleg = Verweis
Verweis = ~/>>\w+/~
VerweisZiel = ~/<\w+>/~
#### BEDEUTUNGS-POSITION #####################################################
BedeutungsPosition = { "BEDEUTUNG" Bedeutung }
BedeutungsPosition = < "BEDEUTUNG" Bedeutung >
Bedeutung = Interpretamente | Bedeutungskategorie
Interpretatmente = LateinischeBedeutung DeutscheBedeutung [Belege]
Bedeutungskategorie = /(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~
Interpretamente = LateinischeBedeutung DeutscheBedeutung [Belege]
LateinischeBedeutung = "LAT" /(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~
DeutscheBedeutung = "DEU" /(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~
Belege = "BELEGE" { "* " EinBeleg }
EinBeleg = /(?:(?!(?:(?:BEDEUTUNG)|\*).)+/~
EinBeleg = /(?:(?!(?:(?:BEDEUTUNG)|\*).))+/~
Beleg = Verweis
Verweis = ~/>>\w+/~
VerweisZiel = ~/<\w+/>/~
#### AUTOR/AUTORIN ###########################################################
Autorinfo = ("AUTORIN" | "AUTOR") Name
Name = WORT { WORT | /[A-ZÄÖÜÁÀ]\./ }
#### MISZELLANEEN ############################################################
......@@ -80,4 +85,4 @@ GROSSSCHRIFT = /[A-ZÄÖÜ]+/~
LEER = /\s*/
DATEI_ENDE = !/./
NIEMALS = /(?!.)/
\ No newline at end of file
NIEMALS = /(?!.)/
#!/usr/bin/python3
"""compile_MLW.py - simple utility script for compiling MLW.ebnf
Author: Eckhart Arnold <arnold@badw.de>
Copyright 2017 Bavarian Academy of Sciences and Humanities
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import os
import sys
sys.path.append(os.path.abspath('../'))
from ParserCombinators import run_compiler
run_compiler("MLW.ebnf")
#!/usr/bin/python3
"""compile_MLW.py - simple utility script for compiling MLW.ebnf
Author: Eckhart Arnold <arnold@badw.de>
Copyright 2017 Bavarian Academy of Sciences and Humanities
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import os
import sys
sys.path.append(os.path.abspath('../'))
from ParserCombinators import run_compiler
run_compiler("fascitergula.mlw", os.path.join('..', 'MLW_compiler.py'), ".xml")
......@@ -11,6 +11,7 @@ VARIANTEN
GRAMMATIK
nomen; -ar f.;
-us, -i m.: >>beleg_id_1;
-um, -i n.: >>beleg_id_2
......@@ -21,8 +22,6 @@ SCHREIBWEISE
festregel(a): >>beleg_id_4,
fezdregl(a): >>beleg_id5
BEDEUTUNG
LAT pannus, faciale, sudarium
......
......@@ -20,7 +20,7 @@ factor = [flowmarker] [retrieveop] symbol !"=" # negative lookahead to b
flowmarker = "!" | "&" | "§" | # '!' negative lookahead, '&' positive lookahead, '§' required
"-!" | "-&" # '-' negative lookbehind, '-&' positive lookbehind
retrieveop = "::" | ":" # '::' pop, ':' retrieve
retrieveop = "::" | ":" # '::' pop, ':' retrieve
group = "(" expression §")"
option = "[" expression §"]"
......
......@@ -26,7 +26,7 @@ import sys
sys.path.append(os.path.abspath('../'))
from ParserCombinators import EBNFGrammar, EBNFTransTable, EBNFCompiler, full_compilation, Forward, RegExp, \
Alternative, Sequence, Token, compile_python_object, compileDSL, ParserRoot
Alternative, Sequence, Token, compile_python_object, compileDSL, ParserHeadquarter
arithmetic_EBNF = r"""
expression = term { ("+" | "-") term}
......@@ -103,7 +103,7 @@ class EBNFGrammar(ParserRoot):
"""
class LeftRecursiveGrammar(ParserRoot):
class LeftRecursiveGrammar(ParserHeadquarter):
"""formula = expr "."
expr = expr ("+"|"-") term | term
term = term ("*"|"/") factor | factor
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment