Browse Source

Added COMBO SYNTACTIC semantics. Update readme.

Joeri Exelmans 5 years ago
parent
commit
fe0d796949

+ 3 - 3
README.md

@@ -6,10 +6,10 @@
 
 * CPython >= 3.6 or PyPy >= 7.3.0 (Compatible with Python 3.6)
 * The following packages from PyPi:
-  * [lark-parser](https://github.com/lark-parser/lark) for parsing action code and various fragments of the statechart language
-  * [lxml](https://lxml.de/) for parsing the statechart XML input format
+  * [lark-parser](https://github.com/lark-parser/lark) for parsing action language code and various fragments of the statechart language (such as target state references in an XPath-like syntax)
+  * [lxml](https://lxml.de/), wraps the C-library libxml2, used for parsing the statechart XML input format
   * [termcolor](https://pypi.org/project/termcolor/) for colored terminal output
-  * [dataclasses](https://pypi.org/project/dataclasses/) (not needed for Python >= 3.7)
+  * [dataclasses](https://pypi.org/project/dataclasses/) standard library backport, not needed for Python >= 3.7.
 
 ### Optional
 

+ 10 - 6
src/sccd/statechart/dynamic/statechart_instance.py

@@ -62,12 +62,12 @@ class StatechartInstance(Instance):
 
 
         if semantics.big_step_maximality == BigStepMaximality.TAKE_ONE:
-            self._big_step = combo_step = SuperRound(termcolor.colored("big_one", 'red'), small_step, maximality=TakeOne()) # No combo steps
+            self._big_step = combo_step = SuperRound(termcolor.colored("big_one", 'red'), subround=small_step, maximality=TakeOne()) # No combo steps
 
         elif semantics.big_step_maximality == BigStepMaximality.TAKE_MANY or semantics.big_step_maximality == BigStepMaximality.SYNTACTIC:
             # Always add a layer of 'fairness' above our small steps, so
             # orthogonal transitions take turns fairly.
-            combo_one = SuperRound(termcolor.colored("combo_one", 'magenta'), small_step, maximality=TakeOne())
+            combo_one = SuperRound(termcolor.colored("combo_one", 'magenta'), subround=small_step, maximality=TakeOne())
 
             if semantics.combo_step_maximality == ComboStepMaximality.COMBO_TAKE_ONE:
                 # Fairness round becomes our combo step round
@@ -75,15 +75,19 @@ class StatechartInstance(Instance):
 
             elif semantics.combo_step_maximality == ComboStepMaximality.COMBO_TAKE_MANY:
                 # Add even more layers, basically an onion at this point.
-                combo_step = SuperRoundWithLimit(termcolor.colored("combo_many", 'cyan'), combo_one, maximality=TakeMany(), limit=LIMIT)
+                combo_step = SuperRoundWithLimit(termcolor.colored("combo_many", 'cyan'), subround=combo_one, maximality=TakeMany(), limit=LIMIT)
+
+            elif semantics.combo_step_maximality == ComboStepMaximality.COMBO_SYNTACTIC:
+                combo_step = SuperRoundWithLimit(termcolor.colored("combo_syntactic", 'cyan'), subround=combo_one, maximality=Syntactic(), limit=LIMIT)
 
             else:
                 raise Exception("Unsupported option: %s" % semantics.combo_step_maximality)
 
             if semantics.big_step_maximality == BigStepMaximality.TAKE_MANY:
-                self._big_step = SuperRoundWithLimit(termcolor.colored("big_many", 'red'), combo_step, maximality=TakeMany(), limit=LIMIT)
-            else:
-                self._big_step = SuperRoundWithLimit(termcolor.colored("big_syntactic", 'red'), combo_step, maximality=Syntactic(), limit=LIMIT)
+                self._big_step = SuperRoundWithLimit(termcolor.colored("big_many", 'red'), subround=combo_step, maximality=TakeMany(), limit=LIMIT)
+
+            elif semantics.big_step_maximality == BigStepMaximality.SYNTACTIC:
+                self._big_step = SuperRoundWithLimit(termcolor.colored("big_syntactic", 'red'), subround=combo_step, maximality=Syntactic(), limit=LIMIT)
 
         else:
             raise Exception("Unsupported option: %s" % semantics.big_step_maximality)

+ 1 - 0
src/sccd/statechart/static/statechart.py

@@ -18,6 +18,7 @@ class BigStepMaximality(SemanticAspect, Enum):
 class ComboStepMaximality(SemanticAspect, Enum):
   COMBO_TAKE_ONE = auto()
   COMBO_TAKE_MANY = auto()
+  COMBO_SYNTACTIC = auto()
 
 class InternalEventLifeline(SemanticAspect, Enum):
   QUEUE = auto()