状态机生成规则

发布时间 2023-03-29 20:59:51作者: 月夜魂归

笔记软件在2023/3/29 20:57:13推送该笔记

状态机生成规则

//状态机
BTState:
    'state' name=ID '{' states+=State* '}';
//状态
State:
    name=ID;
//条款
Term:
    'term' ElementName? description=STRING? ;
//条款约束  约束[当事人约束,状态约束,时间约束]等...
InlineStyles:
    (propertyA+=PropertyA|propertyB=PropertyB)*;
// 行为处理
ImportNestingElement:
    ('handle' '[' (classesNames+=[Behavior:ID](',' classesNames+=[Behavior:ID])*)? ']')?;
//处理约束------------------
PropertyA:
    propertyA=('party') 'is' valueA=[SingleElement:ID](',' valueA=[SingleElement:ID])*;
// 约束分为简单约束和复杂约束
PropertyB:
    ('restrict' ('[' (properties+=ChindProperty(',' properties+=ChindProperty)*)? ']')?)?;
// 条件约束
ChindProperty:
    propertyB=Expression (AttributeSymbol attr=ID)? comparisonSymbol=ComparisonSymbol valueB=Expression;

语法规则

主要规则如下【条款规则、行为规则】

条款规则
term State
restrict [当事人约束,时间约束,基于内置函数的一般约束]
handle[behavior+]

行为规则
behavior Behavior
IF [CONDITION] Then [结果表达式]

主要的约束如下

当事人约束
party is [person*]

时间约束
after|before [表达式]

基于内置函数的一般约束
[内置函数] [symbol] [表达式]