Animalipse – 用于AnimalScript的Eclipse插件外文翻译资料

 2022-07-30 21:47:43

Animalipse - An Eclipse Plugin for AnimalScript

Guido Ruml;oszlig;ling1

CS Department TU Darmstadt Darmstadt, Germany Peter Schroeder2

CS Department TU Darmstadt Darmstadt, Germany

Abstract

The algorithm animation language AnimalScript, while highly expressive and versatile, is not easy to edit with no editor support. We have developed an Eclipse plugin for editing AnimalScript that includes a text editor, outline, and code assist. We expect that this plugin will make the editing process much easier and faster. The paper presents both technical aspects of the development and the resulting plugin.

Keywords: AnimalScript, Animal, Eclipse, Plugin, Animalipse

1 Introduction

Animal [5] is a versatile system for creating, modifying and presenting algorithm animations and visualizations (AV content). As far as we know, it is the only AV system that allows users to create AV content using all of the following approaches: bull; visually using drag and drop in a novice-friendly graphical user interface [8], bull; textually using the highly expressive AnimalScript language [7,9], bull; employing a new Java-based generation API, bull; using a set of external applications for generating context-specific animations for trees [10] as well as for graphs and graph algorithms [3,11],

1 Email: roessling@acm.org 2 Email: sevenclev@gmx.net

Electronic Notes in Theoretical Computer Science 224 (2009) 3–14

1571-0661/copy; 2008 Elsevier B.V. Open access under CC BY-NC-ND license.

www.elsevier.com/locate/entcs

doi:10.1016/j.entcs.2008.12.044

bull; as well as using one of the currently more than 200 animation generators of the built-in generator framework [6]. Note that the number of generators does not necessarily indicate the number of algorithms covered, but rather the different “flavors”forthegivenalgorithms, suchasthechoiceoftheprogramminglanguage and the output language used for the presentation. All generation approaches except for the first are directly or indirectly based on using AnimalScript, which is in the process of taking over the role of the preferred representation of Animal AV content from the built-in ASCII notation. The reasons for this development are the human-readable notation of AnimalScript, the ease with which it can be generated from programs and edited manually, and the expressiveness of the language. Since 2008, Animal also includes an integrated display of the BNF-based definition of the AnimalScript notation, as well as (since 2006) a small text editor for directly entering or modifying AnimalScript input and visualizing the results. AnimalScript files contain one command per line, such as a definition of a new graphical object or a transformation of some objects. The animation is organized in steps, each of which can contain one or more commands. If multiple commands are used in a step, the step is surrounded by curly braces {}. Please see [9,7] for more information about AnimalScript. Many of the other established AV systems also cover some of the generation approacheslistedabove. Forexample, JAWAA2[1]andtheGAIGSandJSamba[12] visualizationenginesusedbyJHAVacute;E[4]alsouseascriptinglanguage. JAWAA2also offers a visual editor in its current release. JHAVacute;E offers a set of content generators that are similar to the approaches offered in Animalrsquo;s generator framework and can be run off the web. However, they focus on specifying algorithm parameters, and thus do not allow the definition of visual properties such as colors. While AnimalScript can be edited easily using Animalrsquo;s built-in editor or any arbitrary text editor, the comfort offered by this is somewhat lacking. The internal editor only offers rudimentary editing features; cut, copy and paste features are only supported by using the underlying operating system support. The editor does not offer a search facility, display of line numbers, indication of recognized syntactical or semantical errors, or syntax highlighting. Thus, editing a longer AnimalScript file is awkward and can become frustrating if the system indicates a parsing problem “in line 117”. Despite (usually) precise information about the nature of the error, the lack of line numbers, search or “go to line” functions makes locating and fixing the error a tedious and less than enjoyable process. We decided that his unsatisfying state needed addressing. Essentially, we saw threedifferentapproachestoprovidebetterusersupport: improvethebuilt-ineditor to be comparable in comfort to the userrsquo;s preferred text editor, create a new custom editor for AnimalScript content, or provide AnimalScript bindings for at least one commonly used text editor. It did not seem useful to invest much effort only to improve the built-in editor so that it would be comparable to, but still different from, a given userrsquo;s preferred text editor. The same applied to creating a new custom editor. Therefore, we opted to provide AnimalScript bindings for at least

G. Rouml;szlig;ling, P. Schroeder / Electronic Notes in Theoretical Computer Science 224 (2009) 3–144

one commonly used text editor. We now had to decide which text editor to use. The main target audience for Animal and thus for AnimalScript are students and teachers of Computer Science. We decided to use the text editor provided by the Eclipse IDE, as this IDE is used in many Computer Science courses. Thus, our target users may already be familiar with the basic features of the text editor. The remainder of the paper is structured as follows. In Section 2, we will briefly summarize the features offered by the Eclipse IDE, focusing on plugins and text editors. Section 3 outlines the plugin for editing AnimalScript code using the Eclipse IDE features. Section 4 shows usage examples to illustrate the support for AnimalScript provided by the Animalipse plugin. Finally, Section 5 evaluates the plugin and presents areas for further research.

2 A

全文共26838字,剩余内容已隐藏,支付完成后下载完整资料


Animalipse - 用于AnimalScript的Eclipse插件

抽象
算法动画语言AnimalScript虽然具有高度的表现力和多功能性,但不用编辑器支持就不容易编辑。 我们开发了一个用于编辑AnimalScript的Eclipse插件,其中包含文本编辑器,大纲和代码辅助。 我们期望这个插件将使编辑过程更加容易和快捷。 本文介绍了开发的技术方面和由此产生的插件

Keywords: AnimalScript, Animal, Eclipse, Plugin, Animalipse

1介绍
动物[5]是一种用于创建,修改和呈现算法动画和可视化(AV内容)的通用系统。据我们所知,它是唯一的AV系统,允许用户使用以下所有方法创建AV内容:bull;可视化地使用拖放到新手友好的图形用户界面[8],bull;文本使用高度表达 AnimalScript语言[7,9],bull;采用新的基于Java的生成API,bull;使用一组外部应用程序为树生成上下文特定动画[10]以及图形和图形算法[3,11]
1电子邮件:roessling@acm.org 2电子邮件:sevenclev@gmx.net
理论计算机科学中的电子笔记224(2009)3-14
1571-0661 /copy;2008 Elsevier B.V.根据CC BY-NC-ND许可证开放获取。
www.elsevier.com/locate/entcs
DOI:10.1016/ j.entcs.2008.12.044

以及使用目前200多个内置发生器框架动画生成器之一[6]。请注意,发生器的数量不一定表示所涵盖算法的数量,而是表示计算语言和用于演示的输出语言的不同程度的“虚拟”。除第一种以外的所有生成方法直接或间接地基于使用AnimalScript,该脚本正在从内置的ASCII符号代替动物AV内容的首选表现的角色。 这种发展的原因是AnimalScript的人类可读符号,可以从程序中轻松地生成并且手动编辑,以及语言的表现力。自2008年以来,Animal还包含了基于BNF的AnimalScript符号定义的综合显示,以及(自2006年以来)一个用于直接输入或修改AnimalScript输入并可视化结果的小型文本编辑器。 AnimalScript文件每行包含一个命令,例如新图形对象的定义或某些对象的转换。动画按步骤组织,每个动画可以包含一个或多个命令。如果在步骤中使用多个命令,则该步骤由花括号{}包围。有关AnimalScript的更多信息,请参阅[9,7]。

许多其他建立的AV系统也涵盖了上面列出的一些方法。例如,JAWAA2 [1]和GAIGSandJSamba [12]通过JHAV#39;E [4]所使用的可视化也使用了代码语言。 JAWAA2还在当前版本中提供可视化编辑器。 JHAV#39;E是一组内容生成器,类似于Animal的生成器框架中的方法,可以在网络上运行。然而,他们专注于指定算法参数,因此不允许定义诸如颜色的视觉属性。虽然可以使用Animal的内置编辑器或任意文本编辑器轻松编辑AnimalScript,但是由于这种编辑器的舒适度有些缺乏。内部编辑器只有基本的编辑功能;剪切,复制和粘贴功能只能通过使用底层操作系统支持来支持。编辑器不支持搜索工具,显示行号,指示识别的语法或语义错误或语法高亮。因此,编辑较长的AnimalScript文件是尴尬的,如果系统指示“行117”中的解析问题,可能会变得令人沮丧。尽管(通常)关于错误性质的精确信息,缺少行数,搜索或“对线”功能使得定位和修复错误是一个繁琐而不那么愉快的过程。我们决定他不满意的国家需要解决。

从本质上讲,我们看到了一些可以与用户偏好的文本编辑器相比较,可以将它们与舒适性相比较,可以为AnimalScript内容创建一个新的自定义编辑器,或为至少一个常用的文本编辑器提供AnimalScript绑定。投入大量资源只是为了改进内置的编辑器,因此它与现有用户的首选文本编辑器相当,但仍然不尽相同。这同样适用于创建新的自定义编辑器。因此,我们至少选择提供AnimalScript绑定G.Rouml;szlig;ling,P. Schroeder /电子笔记在理论计算机

在一个常用的文本编辑器。 我们现在不得不决定要使用哪个文本编辑器。 动物和动物脚本的主要目标受众是计算机科学的学生和教师。 我们决定使用Eclipse IDE提供的文本编辑器,因为该IDE用于许多计算机科学课程。 因此,我们的目标用户可能已经熟悉了文本编辑器的基本功能。 本文的其余部分结构如下。在第2节中,我们将总结Eclipse IDE提供的功能,重点是插件和文本编辑器。第3节概述了使用Eclipse IDE功能编辑AnimalScript代码的插件。 第4节显示了使用示例来说明由Animalipse插件提供的AnimalScript的支持。 最后,第5节评估插件,并提出进一步研究的领域。

2 Eclipse IDE简介

Eclipse [2]于2001年由IBM提出,并于2004年转为开源。由于开发人员众多,该平台针对不同的需求提供了大量的插件和扩展插件,包括大量支持的编程语言版本CVS和Subversion的控制系统前端,工作流程和设计组件。最有名的插件可能是Java开发工具,许多学生,研究人员,开发人员和全球教师都在编写基于Java的程序。 Eclipse平台的主要组件是负责图形用户界面的工作台,包括Eclipse窗口的维护和工作区。工作区是一个单独的文件系统,用于处理文件的创建,存储和编辑,包括文件,目录和项目。 Eclipse的图形前端包含通常的菜单和对话框以及编辑器和视图。编辑器用于修改资源 - 最着名的是编辑Java类源代码的Java编辑器。视图负责呈现内容。 Eclipse已经有很多不同的视图,如Problems,Progress或Console视图。图1显示了Eclipse的主要组件的注释屏幕截图,将在以下段落中进行描述。大纲视图提供了一个内容表,如编辑器内容的视图。对于Java类,此视图列出所有方法和导入语句;点击一行直接将文本编辑器放在关联的内容行上。文本编辑器中的较长的组件也可能被折叠以减少视觉混乱,并使其更容易集中在当前的工作区域上。 Eclipse插件是由Eclipse运行时环境加载并添加到平台的Java程序。它们使用Eclipse提供的“扩展点”连接到Eclipse,Eclipse介绍了可以通过给定插件扩展的Eclipse平台的不同方面[2]。扩展点的定义在基于XML的“插件清单”中说明,必须与每个插件一起提供。

Eclipse编辑器的优点之一是集成了有用的功能。这包括语法高亮理论计算机科学中的电子笔记,Eclipse的主要组件的注释截图能够在编辑器中直接跳到给定行,并标记(已识别)问题。在Eclipse中称为“注释”的标记工具可以在文本编辑器旁边的文本编辑器的左边距或右边距上包含一个标记。在左边距的红色圆圈标记中的x形十字标记用于指示语法(或其他)错误,以及右侧滚动条中的红色标记。另外,注释的文本通常以波浪红线表示,并在“问题”视图中放置适当的描述。最后,Eclipse编辑器还可以通过内容辅助来支持用户,通常也称为代码辅助或代码完成。此功能允许用户从当前文本插入符位置的可能的结构或完成的弹出列表中进行选择。它可以用于插入单个关键字或完整的结构,例如if..else ..语句,以及用于选择要调用的给定方法,包括所需的调用参数。这种类型的支持只有在插件分别知道底层语言或类的集合及其方法的语法的情况下才可能。内容辅助的两个方面都可以非常有帮助,节省时间,特别是对于目标语言新手的用户而言。

3 Animalipse:一个用于AnimalScript的Eclipse插件
Animalipse插件预计将提供以下功能:bull;支持将AnimalScript创建和编辑为Eclipse插件; bull;允许使用Eclipse插件安装支持轻松安装; bull;提供剪切,复制和粘贴功能,以及撤消和重做; bull;允许显示行号,动画步骤折叠(在同一动画步骤中仅显示一行命令),自动缩进代码
G.Rouml;szlig;ling,P.Sroroeder / Electronic Notes in Theoretical Computer Science 224(2009)3-146
线条和语法高亮; bull;定位并标记AnimalScript文件中的错误; bull;在Eclipse Outline视图中显示一个有用的概述; bull;最终为AnimalScript命令符号提供内容帮助。插件中编辑的AnimalScript文件也可以直接从插件运行,以便用户不必外部启动所需的Animal系统。 Animalipse插件基于Eclipse文本编辑器,因此直接继承了一些所需的功能,例如对剪切,复制和粘贴的支持,以及Eclipse插件的简单安装。图2显示了插件的截图,类似于图1进行注释。插件的各个元素将在以下小节中进行更详细的描述。另外,子元素将在第4节的较大屏幕截图中呈现。

具有注释的Animalipse Eclipse插件概述
3.1

解析AnimalScript内容上面列出的一些功能,特别是标记错误,语法突出显示和内容辅助功能,要求编辑人员“理解”正在编辑的内容。由于编辑者可能还需要多次请求相同的信息,因此我们决定为AnimalScript(AS-DOM)实现一个文档对象模型(DOM),以便更快速,更具表达性地访问有关当前选定元素的信息,当前编辑位置。 AnimalScript-DOM的基本结构包括一个根元素,关于AnimalScript内容的元数据以及一组动画步骤。

就像动画一样。每个步骤都可以包含一个或多个动画命令。创建AnimalScript-DOM需要从文本编辑器中解析UTF-8编码的AnimalScript内容。通过在Eclipse编辑器类提供的IDocument中注册为观察者,可以自动通知解析器,了解代码中的更改,从而更新其DOM。然而,每个按键触发更新事件,这将强制系统解析完整的脚本(再次)。因此,我们决定在两次解析迭代之间执行至少2.5秒的等待间隔,以防止编辑器内容的不必要的连续解析。当然这个时间间隔可以由最终用户调整。 Animalipse不直接使用抽象语法树来支持解析过程,而是解析线上的元素。这是可能的,因为AnimalScript要求每个命令将占据一条线(并且每个输入行将只包含一个命令,如果忽略注释或用于指示的大括号)。一个由任意数量的空格分隔的语言元素的命令。

每个元素可以例如是数字,文字或关键字。解析的元素的内部表示类似于抽象语法树,称为ASAST for AnimalScript-Abstract Syntax Tree。当通过解析类似BNF的定义文件启动插件时,创建树的定义,这使得稍后适应AnimalScript语言变得容易。清单1显示了用于定义多边形对象,特别是正方形的BNF类定义的摘录。非终端符号放在lt;gt;中。非终端符号后的冒号将符号与其定义分开。因此,可以将polygonTypes非终端符号修改为正方形,矩形,三角形或多边形非终端符号的实例。 “ID”字段后面的$ idDescr标签提供了下一小节描述的内容辅助的元信息。根据BNF,广场的定义包括关键字square,后面是双引号的Square的ID,一个节点定义和一个描述广场左上角及其大小的自然数。其他元素放置在括号中,表示它们是可选的:方形轮廓的颜色,其深度,圆形选项 - 圆形是否填满,如果是,则使用哪种颜色和显示选项选项被隐藏或仅在延迟后才可见。请注意,每个可选元素从元素与其前身分隔开的空格开始。该空间也用于内容辅助,如下一小节所述。清单1:用于定义Animalipse 1的正方形和矩形的示例BNF lt;polygonTypesgt;:2 lt;squaregt; | lt;rectgt; | lt;trianglegt; | lt;polygongt; 3 lt;squaregt;:4 square“ID”$ idDescr lt;nodeDefinitiongt; lt;nat gt; [color lt;colorgt;] 5 [depth lt;natgt;] [lt;fillOptionsgt;] [lt;displayOptionsgt;]
G.Rouml;szlig;ling,P.Sroroeder / Electronic Notes in Theoretical Computer Science 224(2009)3-148
6 lt;rectgt;:7 lt;absoluteRectanglegt; | lt;relativeRectanglegt; 8 lt;absoluteRectanglegt;:9个矩形“ID”$ idDescr lt;nodeDefinitiongt; lt;nodeDefinitiongt; 10 [color lt;colorgt;] [depth lt;natgt;] [lt;fillOptionsgt;] 11 [lt;displayOptionsgt;]

3.2

内容辅助Animalipse的内容辅助功能使用Eclipse编辑器提供的内容辅助组件。基于脚本的内部表示和当前位置,插件创建可用于完成当前选择的内容的建议列表。与许多其他语言(包括Java)相比,此过程对于AnimalScript内容是不利的:AnimalScript使用的符号包含许多可选的关键字或元素,使任何给定点的可能完成次数相对较高。在列表填充之后,它被呈现给用户,然后被提示选择其中一个元素。类似地,在给定的AnimalScript输入文件中定位语法错误也是由于可选元素的丰富而不利的。在这种情况下,解析过程中(几乎

全文共9372字,剩余内容已隐藏,支付完成后下载完整资料


资料编号:[142914],资料为PDF文档或Word文档,PDF文档可免费转换为Word

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。