没有合适的资源?快使用搜索试试~ 我知道了~
Electronic Notes in Theoretical Computer Science(电子笔记理论计算机科学)127(2005)15—26www.elsevier.com/locate/entcs基于 规则 的 编程 与diaplan 计划Frankdrewes 。1institutio ;nE nF¨o ;rdatavetenskap 数据UME˚AAuniversitetS - 9018 7 umE˚A A,swEIUBerthold饰 Hou Man 2,3 Raimund 的Klein 4信息 技术 中心universit¨AAtBrEm和D28334 不来梅GermanymarkMinas 5FA AKu l t¨A AtFu¨rinFo ;rmAAtikuniversit¨A AtderB绝望rMu¨陈D - 85577 Neubiberg ,Germanyabstract抽象dia plan计划is a language for programming with graphs and diagrams that is currently being designedand implemented by the authors.是一种使用图形和图表进行编程的语言,目前由作者设计并实现。Inthis paper,a programming example,declaration grids,shall illustrate how在本文中,程序设计示例,解释网格,shall illustrate how dia plan计划支持功能性和面向对象的编程风格。 前 - ample alsoindicates which features are needed beyond those discussed in previous work on the language ( 在 语言 上 的 先前 工作 中 需要 考虑 的 因素 )(9].Keywords:视觉 语言 , 视觉 编程 , 基于 规则 的 编程 , Graphtransformation1 Email :drewes@cs.umu.se2此 作者 由 ESPRIT 工作 组 支持语法 和 语义 输入 : 视觉 建模 技术 的 迁移(s E GRA v IS,www.segravis.org).3 Email :hof@tzi.de4Email :ray@tzi.de5 Email :minas@acm.org1571 - 0661 © 2005 Elsevier B . V. 公司Open access under 的 问题CC BY-NC - ND license 。编号:10.1016/j.entcs.2004.12.02716F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-1Introduction介绍多种 工具 和 不同 的 语言 使用 图形 作为 数据 结构 , 并且Graphtransformation as Computation规则 ,G , p ROGRES(13],A GG(5] ,F乌 贾 瓦(6],及GR E at(10]. We are designing A A NEW DiagramProgramming language 编程 语言, ,diaplan 计划我们 在 哪里 利用 了小说 的 概念 , 像 图形 层次 , 图形 形状 和 图形 变量3,8英文 名 :for a better structuring and typingof graphs,and for more adequate notionof graph transformation.(图中文字,已被标注)Further ProgrammingConcepts , like functional abstraction , control , and encapsula - tion areadded in a way that preserves the graph - and rule based nature of thelanguage ( 一 种 以 功能 抽象 、 控制 和 封装 为 基础 的 语言 特性 为基础 的 编程 概念 , 已 被 添加 )9]. Moreover , 其 实施 将 与 The DIA G和编辑 器 Generator (12英文 名 : That the Grams Manipulated Bydiaplan 计划程序 可以 创建 并 显示 为 diagrams , 在 标记 中 自 定义其 应用 程序 域 。In this paper,we illustrate the con—cepts by discussinga speci fication of我们说明了问题——讨论了一种规范的定义DeclarationGrid 介 绍for the static semantic analysis of block—oriented programminglanguages块面向编程语言的静态语义分析。此 讨论 将 指示some 一些之后Concept 概念that are需要在The语言 |The rest of the paper is structured as follows:The next section describesthe kind of graphical data structures used in本文的其余部分已按如下方式构造:下一节描述图形数据结构diaplan计划以及它们的类型有多特殊。在 Section 3 , We show how Computation is 规 格 FECI 及 performed 。thenWe Discuss how program CAN be被 剥夺 的在CLASS ,在Section4。 We conclude with comparing 比较our 我们Work两 个related 相关图 -及基于 规则语言 , 素描The ongoing implementation 实施of A A diaplan计划解释 器 ,及indicating some work to be 做 一些 工作唐2DATA在diaplan计划“每一个数据的构成部分都是以图表的形式呈现的。6Forthe informal view taken in this paper , it su jounces to know that the nodes在 本文 中 , 你 需要 知道 的 是 什么of a graph are drawn as circles,ovals,or boxes,and its edges as lines or arrows.(图中的图案像圆圈,椭圆或框,其边缘像直线或箭头)Each node of a graph可能是一个图集装箱这是另一个图形的内容。7因此 , 图形 可以 在 hierarchically nestedfashion 中 构造 。这种 结构 是 不同 的 。diaplan 计划from many other其他基于 Graph六实际上,diaplan计划使用Hierarchical Hypergraphs Hypergraphs are generalizationsof—rected graphs的。一个hypergraph包含节点和超边缘的地方each hyperedge con—F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-17nects some nodes.连接节点的数量由hy的标签决定。A directed graph is a hypergraphwhere each hyperedge connects exactly two nodes(一个有两个节点的hypergraph在哪里出现)diaplan计划's概念of hierarchical hypergraphs is brie in the following.(分层hypergraphs的概念在后续中广泛传播。for简化 ,Hierarchical 的Hypergraph 的arecalled graphs ,及Hyperedges 的are called在 this纸 。7实际上,hyperedges可能是容器,太。此 功能 不 需要 在 此纸 。18F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-language(13,5,6,10] where 哪儿data is模型as one 一Monolithic 的Graph 。 雀巢 公司 Nesting Resemble The concept of hierarchical 的graph ;However ,our 我们Hierarchy 的are Strict in the sense that graph containedin one node may not be connected to those 在 一 个 节点 的 感觉 可能 不会连接 到 这个contained 相关在Other nodes(8]. extending Earlier 的发明 , We Now allow nodes to be 加 入 列 表 attributed 的 by primitivevalues , such as numbers and strings ( 原始 值 , 如 数字 和 字符 串 )经常 需要 在 应用 程序 中 , 并且 需要 在 最 需要 的 概念 中 : 节点May not only 唯一contain graphs ,but primitive 原始价值 观as好 的 。例2.1 [视频]我们正在进行的测试Declaration Grid介绍,an abstract datatype that is used for e efficient static semantic analy,一个抽象的数据类型,这是用于E高效静态语义分析—英文 名称 : Block StructuredProgramming Languages (14” ( 见 9.1.2 节 ) 。用 其他 语言 , 宣言可能 需要 隐藏 当地 的Global相同的身份的发现。对于简单的说法,我们假设过度装载已被禁止。每个人都有最多的一个可见的定义。Figure 的1显示 如何 确定 网格 可以作为 一 个 表 在 一 个 批准way 。∗vD 6D3wD 7D4D 1xyD 8D5D 2⊥zFig. 1。《The Declaration Grid》它的流程和列分别代表了身份者和程序的块。《网络的细胞》(The Cells of the Grid contain Declarations)这些 价值 是 代表 的asgraphsD 1,···,D 8 whose结构Depends 的on The actual Programming language两 个be实施的 。此外,我们假设这是一个独特的声明。ident—fiers are represented by nodes containingtheir.(身份者由节点控制其)KEYS{五、,z}(典型地是具有差异的整数)。每 一 个 十 年 目标( Target of Declarations associated to one identier )The固体箭(英语:Solid arrow)is visible whereas the others(which are target of dashed arrows)arehidden.顶级 连锁 酒店 The Top Chainof small Circle Presents 介绍The stack of Blocks。 每 一 次column Presents 介绍The包of本地 化 到 一 个 块 , 通过 一 个 dotted edges 束 。 我们 假定 所有 的认知 者 都 有 一 个 声明 。⊥ in the fuctious outermost block of the 表面 上 的table 。QGraphs are typed:节点和节点可能会被标记为使用符号或文本,但也可能由其形式,颜色,或其他布局属性,并且可能受其源代码和目标节点类型的限制。In a Declaration Grid , for instance , dotted arrows mayonly con nect ( 可能 只 开 一 个 圈 )block nodes( 小圈子 )withDeclaration 宣言nodes( Big ,fat-lined 相关的 圈子 ) 。不 像p ROGRESF. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-19(13],diaplan 计划HAS no multiplicity 多元限制特别 的 ,G ,20F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-⊥iB1i1∗11B1D::=::=|::=|::=::=Fig. 2。定义边界的形状。 规则for t initializes the outermost block;the;最后的块i Rule de FenneDeclaration Stacks定义栈D for identientifers,starting with their outermost declaration(从最遥远的定义开始)。 theBRule de fine the stack of block nodes块节点的堆栈最后的规则The Furst Rule for Dgenerates an identifier with its visible declaration.(生成一个身份证明,并附有其可见的定义) Allthese rules replace a nonterminal by a graph in a context—free way.所有这些规则都以无上下文的方式取代无终端。 In the last rule,the nonterminal在最后的规则下,非终端D is only replaced in thecontext of two distinct block nodes numbered在两个不同的块节点的范围内1和2。(When应用 制定规则 , 我们 必须 找到injective 的Occurrences of their left hand sides in 他们 的 左手 边The hostgraph ) the Labels z及D在D rules indicate that The corresponding 相关nodes containNumbers 数字及Declaration 宣言graphs ,respectively 。 while 什么 时候z is A A prede figned ;primitive 原始类型 ,D is assumed to 的be陈 晓 晓By means of另 一 个 ,independent 独立 的setof形状rules 。 Qthat exactly one dotted edge enters a declaration node.明确的一个边缘节点。For,in general,such constraints require dynamic type checks.(一般情况下,要求动态类型检查)instead , the形状of graphs can be 可以规格 FECI By Recursive rules using HyperEdge 的 replacement 替 换 ( 1].However ,原 - Tending the usual context-free rules these rules may exploitcontext as defigned . 一般 情况 下 , 这些 规则 可能 会 被 证明 是 有效的 。in (2 [ 1 ] 这 允许 以 比 大多 数 其他 语言 更 广泛 的 方式 进行 打字 。在 Fig-ure 2“ 我们 发现 这种 方式 的 解释 电路 的 形状 。没有必要的语言允许指定特定类型的图形LAN—guages。Hence , the type ofdeclaration grids could not be founded as precisely as in Figure ( 亨斯 ,定义 电路 的 类型 不 可能 是 精确 的 , 如 图 )2在 Such ProgrammingLanguages .3Computation在diaplan 计划, Computations Are Performed By 计算机 性能graph 转换(8]. Pro—grams是由图形转换规则确定的。Within Rules,two kinds ofgraph elements play particular roles 在 哪 里 ? Variables ( labeled byuppercase letters)are edges or variables acting as placeholders for graphs orprimitive values,and(由uppercase letters labeled)其它资源,如图或原t1iDB1z1123DB123DDBF. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-21始值的占位符,和预言EDGE(Labeled by Names in Lower Case):制定图形转换规则。A rule is applied by founding,in some con container ofa graph,the constant subgraph(一个法则,在某些情况下图表的容器,持续的提纲)最 大 子 图 , 没有 任何 变数 ) of a rule 's left handside , binding its variables to appropriate subgraphs , and replacing thematch by the rule 's right hand side , where . 在 规则 的 右手 边 , 将 比赛 固定 到 适当 的 subgraphs , 并 重新 安排 比赛 。- -22F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-ables 的are replaced 的By Their Bindings 。 8the Evaluation战略 Strategy isas Follows :一 个 开始 的 图形 容器 预测 ( 但 通常 不 含 变量 ) 是通过 将 规则 应用 于 预测 尽 可能 长 的 时间 来 改变 的 。每一步,一条规则适用于最需要预测的最深处之一,该规则已经投入了最多的数量。如果没有预测匹配的规则,则执行失败;回溯跟踪可能会导致进一步的规则,直到所有预测都已完全评估,离开图表(没有预测和可变)作为结果。This corresponds to 相关最 内在 评价known from 功能 性LAN - guages ,及两 个Depth - 发音 ( 英语 )search 搜索for结果 ,asknown from Logic语言 。 9( 参见 [9] 为details . )他认为这意味着抽象和控制。与 尊重 抽象 , 预测 与 单位 相同GRE at ( 10 [ 生 产 与 交 易 ] productions and transactions 在 p ROGRES(13],及methods 方法在F乌 贾 瓦(6]. nodes Being当前 位置 : 线 上翻译 > 英语 翻译 > vis - ited by a predicate hyperedge correspond to ports inGR E at, and parameters 在p ROGRES及F乌 贾 瓦。 However ,Whileexisting 存在language基于on graph 转换( G , GR E at,p ROGRES,orF乌 贾 瓦)use AN imperative 命令风格 for特 悬股票of控制 ,diaplan 计划Uses A A Declarative 介绍style模拟 器两 个逻辑 或 功能 程序 设计这种风格减少了语法糖的需要,以便指定序列,替代或程序抽象。实际上 , 使用 Predicates together with application guards ( see )9) 是高效的 。示例 3.1 [ 网络 声明 操作 ( Operations on Declaration Grid ) ] 3两 个7我们 对 确定 网格 的 操作 作为 预测 :init为 一些 识别 者 构建 空 网 ;open 开放pushes a new block ; Close pops a block with its local declarations ;以及enter Inserts a Declaration for an identist into the Grid ; ( 插入 一 个识别 者 进入 电网 的 声明 )而 ,Lookup RETURNS The visible 可见Declaration 宣言of AN身份 鉴定每 一 次 预测 都 是 由 一 系列 规则 所 代表L/R where 哪儿l这 是 TheLHS ( which is replaced by the right hand side ) 即 左手 边 , 也 就是 右手边R。 Edges是由arrows或rectangles代表。 节点是由圆圈代表或与圆角落的rectangle。小数字表明LHS和RHS节点的正确性。已标记为较低的名称表示当前的Edge。Lhs of a rule belonging to a predicate 一 个 规则 赋予 一 个预言 者contains a cor - -8 Binding of a variable to a subgraph and replacing a variable by its binding is describedin ( 绑定 一 个 变量 到 子 图形 并 重新 定位 一 个 变量 )2,9作品 本质 上 如下 : A graph as a binding of a variable edge has some Special Node , Called 特别 节点Points 项目这些 都 包含 在 一 个 序列 中 。The number of points has to be equal tothe number of nodes that are connected by the bound variable as a hyperedge.在这个数字中,节点的数目应等于一个超边缘节点的数目。A variable edge是通过removing thevariable edge来重新定位的,并在其绑定中粘贴,其中绑定点已被变量edge访问过的节 点 已 填 充 。 A variable node can be bound to any node with appropriate type andcontents,可以绑定到任何指定类型和内容的节点原始 值 或 containedGraph 。9 Other Choices Would Have Been其他选择lazy评价及breadth—最广泛的搜索。 TheyF. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-23have not chosen since lazy evaluation makes program debugging a di hüfcult task , andbreadth - 他们 没有 懒惰 , 因为 懒惰 评估 使 程序 debugging a di 高效 工作 组 任务 ,和 呼吸 -搜索 结果 in generally less e hefficient than depth搜索 。24F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-∗x⊥inix1⊥1x⊥ini∗t1∗txDDJClose1∗txDJClose1∗tClose∗txDDJxDxLookupxDtxini1///Fig. 3。The Predicate预言init 4.随机生成一个离散的ID节点图(Bound to the Variable)x + adds afacticious outermost block with one local declaration(加上最外部的块,加上一个本地定义)⊥ (未完待续)。 《It Calls The Recursive》ini(2)、“工程”是指集装箱内的任何标识物和“标识物”。。Applying this rule has to reserve the rule 应用 此 规则 已经 保留⊥” [ 10 ] 这 段 话 说明 了 一 个 问题 :9]). The Predicate 预言Terminates 终点successfully 成功 的("+")IF no identi 身份is孤立 的在The grid any More 。 Q111///Fig. 4。The Predicate预言open 开 放 Pushes A NewBlock(推送一个新区块)onto the stack of blocks(块的堆栈) Q1Fig.5。The Predicate预言Close删除最内部的块与所有声明。第二条规则是从最内部块移动一个本地声明;第二条规则是从块堆栈中最内部节点移动。 Q13//2Fig. 6。The Predicate预言enter enters a declaration进入声明D for an identi身份x to a grid if theprevious declaration最后一个解释D 'of x is not local to the current block;otherwise(一个例外)over(for Overloading过度装载) 被raised。 Q1122/3Fig. 7。 The Predicate预言Lookup发表声明Retrieves the Declaration x这实际上是可见的。 the预言init每个人都有自己的认知,这是一种认知。⊥ 至少。 Qresponding predicate edge in its LHS.(在其LHS中预测边缘)No otherpredicate edge is permitted.(没有其他预测的Edge被允许。uppercasename 表 示 变 量 edges 或 变 量 nodes 。 A Predicate def—Inition My BeFollowed By(一个预言者——我的预测被跟踪)e/e如果此预测不能由其规则的任何规定解决,则该行为将不受限制。+ In a Box Means的评论Success E,E,The corresponding predicate edge is simply deleted.(正确预测的Edge只是被删除)The Box Labeled的评论over使用Throws anException。更多 详情 Can be found in(9].Close Inspection shows that the predicates in Figures 的 相关 资料3两 个7保留 形状 Preserve The Shape of Declaration 宣言GRIDS规格 FECI在1xinit+∗topen开放∗t∗t3xDJxD2enter3xDtDoverF. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-25Figure 的2。 However ,diaplan 计划is intended to be a statically typedlanguage . 有意 成为 一 种 静态 类型 语言 。把 这 件 事 记 在 心里 , 例子Indicates26F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-∗vD6D3wD7D4D1D8D2⊥xD5y未来的工作必须关注使类型检查成为可能的条件。问题 在于 规则 在 数字 中 如何 保护3 - 7 Cannot be statically 不能 统计checked 的在The waydescribed 描述在(2]因为The transformation规则 不是 “ 形状 ” 在 本文的 感觉 。在 另 一方面 , 规则 是 相当 容易 与 形状 的 确定 规则 给予在 图2 Intuitive Point of View 直觉 的 观点 。应该允许以覆盖上述规则的方式扩展形状规则的定义,或者开发补充本通知的技术。这已经超出了本文的范围,必须在将来进行研究。它 看 起来 不 需要 开发 额外 的技术 来 完成OTHER .读者 可能 已经 注意 到 我们 的 示例 的 定义 扩展 了 其 概念 。9”( in that they specify the )mode of each parameter node in an intuitive way( 直观 的 方法 中 的 每个 参数 节点 )Going and Outgoing ArrowsIndicate正在进行的行动在—And out参数,分别为。10Lines withoutarrow heads indicate 没有 箭头 的 线in-out 介绍parameters 。In ourexample , the table grid is an in-out - parameter to all predicates , 在 我们的 例子 中 , 网格 表 是 一 个 in-out - parameter to 所有 预测 ,identi 身份nodes are in-parameters 参数两 个enter及Lookup,Whereas 的thedeclaration node is an parameter to 在 参数 中enter//输出 一 个 参数Lookup。More interesting extensions of concepts described in previouspapers are其它相关内容sugggested if the example is generalized in order toallow loading.如果示例一般是允许超载。fig-ure 的8 shows an example ofa graph representing such a declaration grid . 显示 网格 的 示例 。在 Figure中 的 定义 规则2我们 可以 用 一 种 更 直接 的 方式 对 这 一 情况 进行调整 。The Generalization of the Required Transforma ( 必需 变革 的 普遍 化 )rules( 实施 )open 开放,Close,enter,及Lookup)is not你好 , Cult either ,10关于 Concept of在- And out parameters 与 the parameters 近似p ROGRES(13 [ ] andthe use of input and output interfaces of 输入 和 输出 接口 的 使用GR E at(10].Fig. 8。A Declaration Grid with Overloading.(一个定义网格覆盖。 形状 与 形状 中 的 形状 相似1except that a given identier may have any number of visible declarations which do not hide eachother . 除非 有 任何 可见 的 标识 符 , 而 不能 隐藏 其他 。 在 The Declaration Grid Shown ,x有F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-27visible declarations D5及D8。 Q28F. drewes 。et艾尔 /电子Notes 文件在理论 上Computer Science 127( 2005 )15-Nevertheless Rise To Interesting 《 决 不 让步 》观察 。(i) 为了 以 适当 的 方式 处理 过度 的 声明enter必须Check Whether 什么The NEW Declaration 宣言hides A A currently 当前visible 可见one一如果 没有 , 那么 什么 是 可能 的 , 什么 是 过度 装载 。这个可以完成~有条件规则Whose applicability depends on the outcome ofboolean predicates布尔值预测结果的趋势hides及Overloadable的。Thus ,enter在 一 个 人 的 前面 有 新 的 宣言 , 或者 是 作为 一 个附加 的 人 , 存在 的 其他 部分 , 或者 是 结果 。Exception 。(ii) 现在 可以 给 一 个 任意 数量 的 可见 的 声明身份 ,Lookup isambiguous 模棱两可 的E , , IT May成功在严重的 方式 。事实 上 , 如果 我们 修改 了 描述 网格 的 表示 略微 通过 删除 标记 节点 ,Lookup《 Namely If There Is No 》visible 可见Declaration宣言for The给予身份 鉴定 这些Observations 观察建议classify predicates by 经典 的 预言multiplicities 的该 指标 如何 经常评估 可能成功 :• 如果预测是确定的,那么它几乎有一个评估。例如 : in general adeterministic predicate may fail . in which case it does not yield . 一般地 , 预测 可能 会 失败 。结果 。• 非 确定 性 Nondeterministicpred
下载后可阅读完整内容,剩余1页未读,立即下载
cpongm
- 粉丝: 4
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功