文本与图形编辑器之间的鲁棒实时同步
1. 树与模型的双向映射
1.1 树到模型的转换规则
树到模型的转换规则定义如下:
1 tree2model: t
→M(<term2obj>)
2 term2obj
: c#(t∗)
→Obj(<def−uri>, QID("ast", c), <map(term2slot)> t∗)
3 term2slot : None()
→None()
4 term2slot : Some(t) →Some(<term2slot> t)
5 term2slot : t∗
→<map(term2slot)> t∗
6 term2val
: t
→Data(t) where is−string; not(ref−uri)
7 term2val
: t
→Link(<ref−uri>)
8 term2val
: t
→Contain(<term2obj> t) where is−compound
这些规则将树的术语表示转换为对象。具体步骤如下:
1. 通过 tree2model 将树的术语 t 转换为模型对象。
2. term2obj 将术语分解为构造函数 c 和子术语 t* ,构造函数用于识别运算符中对应的类,子术语转换为插槽。
3. term2slot 处理不同情况的术
超级会员免费看
订阅专栏 解锁全文
6337

被折叠的 条评论
为什么被折叠?



