From 4e9fb050b7565ca5e7e1c7142709c308f2b1d0ff Mon Sep 17 00:00:00 2001 From: Zihan Chen Date: Thu, 2 Feb 2017 15:44:52 -0800 Subject: [PATCH] Update TODO.md --- TODO.md | 70 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/TODO.md b/TODO.md index 1d6c2f43..0f5680ef 100644 --- a/TODO.md +++ b/TODO.md @@ -16,12 +16,18 @@ * `WfExpression` * `List` * `List` - * For interface: `prop NAME : TYPE [,const][,not observe];` + * CONFIG: + * {} + * {const} + * {not observe} + * {const, not observe} + * For interface: `prop NAME : TYPE CONFIG;` * Expand to Getter / Setter / Event / Property - * For class: `prop NAME : TYPE = EXPRESSION [,const][,not observe];` + * For class: `prop NAME : TYPE = EXPRESSION CONFIG;` * Expand to [@cpp:Private]Variable / Getter / Setter / Event / Property - * For class (override): `override prop NAME : TYPE = EXPRESSION [,const][,not observe];` + * For class (override): `override prop NAME : TYPE = EXPRESSION CONFIG;` * Expand to [@cpp:Private]Variable / Getter / Setter + * Macro * State Machine * Context-Grammar Sensitive Macro * **Workflow to C++ code generation with hint**. @@ -81,27 +87,28 @@ To implement ``` namespace system { - interface IStateMachine + enum StateMachineStatus + { + Stopped = 0, + Executing = 1, + Waiting = 2, + } + + interface StateMachine { func Start() : void; /* Call to restart, will raise exception during execution */ - func Stop(ex : string) : void; /* Call to stop, will raise exception if not started. */ - - func GetIsExecuting() : bool; - event IsExecutingChanged(); - prop IsExecuting : bool {GetIsExecuting : IsExecutingChanged} - - event OnError(Exception^); /* The current step goes wrong and continue to wait for more inputs */ - event OnFatal(Exception^); /* The whole state machine goes wrong and has to stop */ - event OnStart(); - event OnExit(); + func Stop(ex : string) : void; /* Call to stop, will raise exception if it is not executing or waiting for stateinput. */ + prop Status : StateMachineStatus {const} + event OnStop(Exception^ /* null if no statefatal */); } } ``` ### Keywords -* `stateinput` -* `statefatal` -* `stateerror` +* `stateinput`: declaration, statement +* `statefatal`: statement +* `stateerror`: statement +* `statemachine`: declaration ### Syntax ``` @@ -111,7 +118,7 @@ stateerror "exception"; /* redo the current stateinput statement with an err return; /* stop the state machine normally */ /* wait until received expected input */ -switch(stateinput ) +stateinput() { case (, ...): { @@ -123,13 +130,13 @@ switch(stateinput - + + var CountDOwn : ICountDown^ = new CountDown^(); + @@ -183,9 +187,11 @@ interface ICountDown : IStateMachine 0) { - stateinput + stateinput() { case CountDown(): {