• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2


Commit MetaInfo

Revisionecebad1e4f0787a4d5dff6b088de54bb282bcc8f (tree)
Zeit2022-04-14 05:53:37
AutorAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

Improved Design/Peg.puml: Oke but upside-down

Ändern Zusammenfassung

Diff

diff -r bd6054195c00 -r ecebad1e4f07 Design/Peg.puml
--- a/Design/Peg.puml Mon Apr 11 21:36:29 2022 +0200
+++ b/Design/Peg.puml Wed Apr 13 22:53:37 2022 +0200
@@ -1,81 +1,140 @@
11 @startuml
2+
23 abstract AST_BASE {
34 _parse_tree
4- start()
5- end()
5+ position()
6+ position_end()
7+ serialize()
68 }
79
10+class ID {
11+ name
12+ validate_or_raise()
13+}
14+
15+ID =|> AST_BASE
16+
817 package Peg #0077ff {
918
1019 abstract PEG
11-AST_BASE <|== PEG
20+PEG ==|> AST_BASE
1221
13-PEG <|== NonTerminal
14-PEG <|== Terminal
15-PEG <|== Setting
16-PEG <|..... Markers
17-Markers <|== EOF
18-annotation Markers
19-annotation EOF
22+package MixIns #Gray {
2023
24+ class MixIn_value_attribute<MixIn> {
25+ _value
26+ value()
27+ }
28+
29+ class MixIn_expr_attribute<MixIn> {
30+ _expr
31+ expr()
32+ }
33+
34+ class MixIn_children_tuple<MixIn> {
35+ _children :Tuple
36+ __len__()
37+ __getitem__()
38+ __iter__()
39+ }
40+}
2141
2242
2343 abstract Terminal
24-Terminal <|== StrTerm
25-Terminal <|== RexExpTerm
44+Terminal ==|> PEG
45+Terminal ---|> MixIn_value_attribute
46+StrTerm ==|> Terminal
47+RexExpTerm ==|> Terminal
48+Number ==|> Terminal
49+
50+abstract Markers #ORANGE
51+Markers ==|> PEG
52+annotation EOF #ORANGE
53+EOF ==|> Markers
2654
2755 abstract NonTerminal
28-NonTerminal <|== Grammar
29-NonTerminal <|== Rule
30-NonTerminal <|== Expression
31-
32-class Grammar {
33- rules
34- settings
35-}
36-Grammar --> "*" Rule : rules
37-Grammar --> "*" Setting
38-
39-class Rule {
40- name :ID
41- peg_expression
42-}
43-Rule -> "*" Expression
56+NonTerminal ==|> PEG
57+abstract Expression
58+Expression ==|> NonTerminal
4459
4560 class Setting {
4661 name : ID
47- value : ...
62+ value
4863 }
64+Setting ==|> PEG
65+Setting ---> ID
4966
50-abstract Expression {
51- subEexpression Or Terminal
67+class Rule {
68+ name :ID
69+ expr :[] Expression
5270 }
53-Expression --> Terminal
54-Expression --> Expression
71+Rule ==|> NonTerminal
72+Rule ---> ID
73+Rule ---> Expression
74+
75+interface Rules
76+Rules ==|> PEG
77+Rules ---|> MixIn_children_tuple
78+
79+ParseRules ==|> Rules
80+Settings ==|> Rules
5581
5682
57-Expression <|== ManyExpression
58-Expression <|== Group
59-Expression <|== Sequence
60-Expression <|== OrderedChoice
61-Expression <|== Predicate
62-
63-abstract ManyExpression
64-abstract Predicate
83+class Grammar {
84+ +all_rules :Rules
85+ -parse_rules :ParseRules
86+ -settings :Settings
87+}
88+Grammar ==|> NonTerminal
6589
66-ManyExpression <== Optional
67-ManyExpression <== OneOrMore
68-ManyExpression <== ZeroOrMore
6990
70-Predicate <== AndPredicate
71-Predicate <== NotPredicate
91+abstract Group
92+Group ==|> Expression
93+UnorderedGroup ==|> Group
94+UnorderedGroup ---|> MixIn_expr_attribute
95+abstract Quantity
96+Quantity ==|> Group
97+Quantity ---|> MixIn_expr_attribute
7298
99+Sequence ==|> Expression
100+Sequence ---|> MixIn_children_tuple
101+
102+OrderedChoice ==|> Expression
103+OrderedChoice ---|> MixIn_children_tuple
104+
105+'========================
106+class Optional << (?, #0077ff) >>
107+Optional ==|> Quantity
108+class ZeroOrMore << (*, #0077ff) >>
109+ZeroOrMore ==|> Quantity
110+class OneOrMore << (+, #0077ff) >>
111+OneOrMore ==|> Quantity
112+
113+abstract Predicate
114+Predicate ==|> Expression
115+Predicate ---|> MixIn_expr_attribute
73116 class AndPredicate << (&, #0077ff) notconsuming >>
117+AndPredicate ==|> Predicate
74118 class NotPredicate << (! ,#0077ff) not consuming >>
119+NotPredicate ==|> Predicate
75120
76-class Optional << (?, #0077ff) >>
77-class OneOrMore << (+, #0077ff) >>
78-class ZeroOrMore << (*, #0077ff) >>
121+
122+
123+
79124
80125 }
81126 @enduml
127+
128+
129+
130+
131+
132+
133+
134+
135+
136+
137+
138+
139+
140+
diff -r bd6054195c00 -r ecebad1e4f07 Makefile
--- a/Makefile Mon Apr 11 21:36:29 2022 +0200
+++ b/Makefile Wed Apr 13 22:53:37 2022 +0200
@@ -1,6 +1,6 @@
11 default: all
22
3-all: demo test XXX missing
3+all: demo test pyanalyse XXX missing
44
55 missing: missing_visitor missing_serialization
66
@@ -42,3 +42,18 @@
4242 clean_caches:
4343 find . -type d -name __pycache__ -print0 | xargs -0 rm -r
4444 find . -type d -name .pytest_cache -print0 | xargs -0 rm -r
45+
46+
47+PYREVERSE_DIR=pyreversed
48+PYREVERSE_FORMAT=svg
49+PYREVERSE_OPTIONS=-kAmy
50+PYREVERSE_PRJS= castle.readers castle.ast castle.writers castle
51+
52+pyanalyse: ${PYREVERSE_DIR}
53+ for P in ${PYREVERSE_PRJS}; do \
54+ echo "PYANALYSE::" $$P "...";\
55+ pyreverse -d ${PYREVERSE_DIR} -o ${PYREVERSE_FORMAT} ${PYREVERSE_OPTIONS} -p $$P --colorized --max-color-depth=42 -my $$P ;\
56+ echo ".. done. Result-files:" ;\
57+ ls -l ${PYREVERSE_DIR}/*$${P}.${PYREVERSE_FORMAT} ;\
58+ echo;\
59+ done
diff -r bd6054195c00 -r ecebad1e4f07 castle/ast/peg.py
--- a/castle/ast/peg.py Mon Apr 11 21:36:29 2022 +0200
+++ b/castle/ast/peg.py Wed Apr 13 22:53:37 2022 +0200
@@ -126,7 +126,6 @@
126126 """An expression with Quantification; like optional, or repetition. The subclasses defines which Quantification"""
127127
128128
129-#class Sequence(MixIn_value_attribute, Expression):
130129 class Sequence(MixIn_children_tuple, Expression):
131130 """A sequence of expressions; can be of length=1"""
132131 # __init__ (see MixIn) sets self._children; assuming it is a list