首页> 外文期刊>Software >Interpreting computer code in a computer-based learning system for novice programmers
【24h】

Interpreting computer code in a computer-based learning system for novice programmers

机译:面向新手程序员的基于计算机的学习系统中的计算机代码解释

获取原文
获取原文并翻译 | 示例
           

摘要

Although the principles of writing compilers and interpreters are well known, we have found that the ideas needed to develop an interpreter for the express purpose of allowing direct interaction with the running code do not yet appear to have been published in an academic context. We describe a programming method that can be used for the production of an interpreter for common object-oriented languages such as C++, Java and C#. The main purpose of the interpreter is to parse short, relatively simple programs and allow direct interaction between the user and the running code. Such a system is useful for projects such as OGRE, which is an educational tool allowing students to visualize in three-dimensional graphics the state of a program as it runs. The interpreter works by first parsing the source code and building up a data structure capable of representing the program's source code in a form that can be used to both run the program and extract detailed information from the running program. This extraction allows for novel uses of the interpreter, such as forming the basis for a visualization system that must display and provide such information to the user as they watch their executing program. This paper considers the construction of such an interpreter specifically for C++, but the principles should be the same for other similar languages such as Java and C#. We cover the main tasks required of the programmer to create and use the data structure, highlighting areas such as its design, initial construction during parsing, and techniques required to use it for interpretation. These include the ability for the data structure to intelligently clone subsets of itself when multiple copies of one of its elements are required by the running program, how it handles C++'s complicated function overloading and overriding rules, and how inheritance and polymorphism can be supported.
机译:尽管编写编译器和解释器的原理众所周知,但是我们发现开发解释器以实现与运行中的代码直接交互的明确目的所需的思想似乎尚未在学术环境中发表。我们描述了一种编程方法,可用于为常见的面向对象的语言(例如C ++,Java和C#)生成解释器。解释器的主要目的是解析简短的相对简单的程序,并允许用户与正在运行的代码之间进行直接交互。这样的系统对于OGRE等项目很有用,OGRE是一种教育工具,可以让学生在三维图形中可视化程序运行的状态。解释器的工作方式是首先解析源代码,并构建一个能够以一种形式表示程序源代码的数据结构,该数据结构既可以用于运行程序,又可以从运行的程序中提取详细信息。这种提取允许解释器有新颖的用途,例如形成可视化系统的基础,该可视化系统必须在用户观看其执行程序时向用户显示并提供此类信息。本文考虑了专门针对C ++的此类解释器的构造,但其他类似语言(如Java和C#)的原理应相同。我们介绍了程序员创建和使用数据结构所需的主要任务,重点介绍了诸如设计,解析过程中的初始构造以及使用它进行解释所需的技术等领域。这些功能包括当正在运行的程序需要其元素之一的多个副本时,数据结构能够智能地克隆自身的子集的能力,它如何处理C ++复杂的函数重载和覆盖规则以及如何支持继承和多态性。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号