首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到19条相似文献,搜索用时 187 毫秒
1.
一类递归函数的多态类型   总被引:1,自引:0,他引:1       下载免费PDF全文
黄文集 《软件学报》2004,15(7):969-976
以上下文无关语言上的递归函数为基础的语言LFC(1anguage for context free recursive function)是一种形式规约语言,适于处理短语结构.LFC也是函数式语言,具有函数式语言的许多特点.LFC已经在形式规约获取系统SAQ(specification acquisition system)中实现,为其最初设计的类型系统不支持多态类型.引入类型变量和相应的类型检查方法,就可以将其类型系统扩充为多态类型系统.对多态类型系统实现中的一些问题也进行了讨论.在实现多态之后,LFC  相似文献   

2.
对于泛型程序设计来说,类型的参数化多态是其理论框架,参数化多态引入了类型变量,使得类型参数化,支持类型上的抽象,从而可以大大提高软件的复用程度。泛型编程思想已经在多种语言中得到运用,并已取得了不小的成果。在函数式语言上进行泛型的研究与应用,Haskell语言是函数式语言中较为经典的一种语言,它的计算模型简单,语法清晰,易于编写,易于维护,拥有很大的发展空间。利用一些规则对Haskell语言的语法进行相关扩展,同时引入泛型的思想,研究与运用定义泛型函数的方法,在Haskell语言上实现了泛型功能。  相似文献   

3.
梅宏  孙永强 《软件学报》1994,5(6):58-64
本文介绍一以ADT为主要构件的函数语言,它是作者设计的函数式及面向对象式合成语言的函数部分,进而描述了其操作语义模型:多态λ演算十代数重写系统=多态λ重写系统,并讨论该模型的Church-Rosser性质和强范式性质。  相似文献   

4.
对于泛型程序设计来说,类型理论中的参数化多态是其理论框架,因为参数化多态引入了类型变量,使得类型参数化,从而完全支持类型上的抽象。然而对于现行的泛型算法,无论是C++标准模版库中的泛型算法还是基于函数式程序设计语言的算法,函数功能的定义比较具体化、单一化,因而缺乏可扩展性和高度的复用性。将对递归算法进行抽象,构造原始递归构造子,使得一般的泛型算法都可以通过该算子来构造,从而加强泛型算法的可复用型与可扩展性。除此之外,分析了递归算法构造子与泛型程序设计中的iterator概念和用于描叙泛型概念的形式化语言Tecton中所提倡的reuse概念的一致性。也给出算法复杂度的定量分析,并用函数式语言ML来实现。  相似文献   

5.
对于泛型程序设计来说,类型理论中的参数化多态是其理论框架,因为参数化多态引入了类型变量,使得类型参数化,从而完全支持类型上的抽象.然而对于现行的泛型算法,无论是C 标准模版库中的泛型算法还是基于函数式程序设计语言的算法,函数功能的定义比较具体化、单一化,因而缺乏可扩展性和高度的复用性.将对递归算法进行抽象,构造原始递归构造子,使得一般的泛型算法都可以通过该算子来构造,从而加强泛型算法的可复用型与可扩展性.除此之外,分析了递归算法构造子与泛型程序设计中的iterator概念和用于描叙泛型概念的形式化语言Tecton中所提倡的reuse概念的一致性.也给出算法复杂度的定量分析,并用函数式语言ML来实现.  相似文献   

6.
董士珍 《福建电脑》2010,26(2):55-55,76
多态是C++语言中最重要的特性之一,而虚表以及虚函数是实现多态的重要手段。许多C++语言的教材对于虚函数的使用以及调用机制有着详细的阐述,但是对于虚表的一些细节内容阐述却并不是很深,对于虚表我们可能会有很多疑问。本文就试图通过使用汇编语言对于虚表实现的细节进行分析,从而加深对多态机制的理解。  相似文献   

7.
协变-反变问题讨论面向对象语言中继承机制和多态计算的关系,晃当前面向对象程序设计语言中的一个重要的理论问题。反变的方法重定义不符合思维习惯,一盘采用协变精化的设计方法。但抛弃反变后的面向对象程序设计,在多态计算中会产生类型问题。针对这一问题,该文基于Castagna的重载函数模型,提出处理协变相关类型问题的类型系统和计算模型,并在ND-Polya语言及系统中具体实现。该方法可以应用到其它协变面向对  相似文献   

8.
OOFL是我们设计的一种面向对象的函数式语言,该语言具有对象式语言和函数式语言的优点。本文详细介绍了OOFL到C++的转换技术,构造了OOFL语言的元程序设计环境,探讨了对象函数式语言的一些实现方法,并在微机上实现了OOFL到C++的转换系统。  相似文献   

9.
程序信息流安全是信息安全的一个重要研究方向.基于类型的静态分析可以保证程序信息流安全.鉴于分布式移动计算系统中进程之间的通讯会引起严重的信息泄密,本文研究了进程之间的通讯对系统信息流安全的影响,通过对高阶函数式编程语言进行扩充,加入通讯原语,得到分布式移动计算语言ConcurML,它能很好地模拟网络连接的动态性和代码移动性.并给出了动态语义和静态语义的形式描述,所设计的两级信息流类型系统使用类型和效果技术,结合了多态这样的类型特征,能有效地保证进程之间的通讯不会导致信息泄密.  相似文献   

10.
为了能够减小运算系统的需信任计算基础、描述较小粒度的安全策略,目前的研究倾向于从程序设计语言和编译器入手来提高软件的安全性.基于以上研究背景设计了一种类型化的低级语言TLL,TLL是一种为Java虚拟机即时编译器设计的类型安全中间语言,以构造一个具有更小需信任计算基础的Java虚拟机系统为目的.TLL的类型系统基于多态的类型化λ演算,它具有丰富的表现力且能够编码各种高级语言的抽象.基于TLL的一个虚拟机原型系统已经实现,它可以作为实现一个高安全且面向多种源语言的运行时系统的起点.  相似文献   

11.
郑红军  张乃孝 《软件学报》1998,9(3):194-199
本文从Ideal的基本概念出发,研究了Ideal作为类型的语义模型所具有的性质.在类型的Ideal模型下,讨论了Garment中参数化多态类型和约束多态类型的语义.并在此基础上,证明了Garment中类型规则的语义可靠性.  相似文献   

12.
The authors consider the user of modern functional languages, which support user-defined data types, polymorphic types and functions, pattern matching, and several kinds of modularity, as well as two important features not found in most conventional languages: lazy evaluation and higher order functions. Coroutines, modularity, and parallelism are discussed. The authors describe how a functional language provides these modern features and how to exploit its advantages. The examples are written in Miranda, the most widely used modern functional language, but the techniques can be used in almost any modern functional language. They use quadtrees because they illustrate these features and techniques nicely.<>  相似文献   

13.
We present a graph-basedmodel of a generic type system for an OO language. The type system supports the features of recursive types, generics and interfaces, which are commonly found in modern OO languages such as Java. In the classical graph theory, we define type graphs, instantiation graphs and conjunction graphs that naturally illustrate the relations among types, generics and interfaces within complex OO programs. The model employs a combination of nominal and anonymous nodes to represent respectively types that are identified by names and structures, and defines graph-based relations and operations on types including equivalence, subtyping, conjunction and instantiation. Algorithms based on the graph structures are designed for the implementation of the type system. We believe that this type system is important for the development of a graph-based logical foundation of a formal method for verification of and reasoning about OO programs.  相似文献   

14.
Free theorems establish interesting properties of parametrically polymorphic functions, solely from their types, and serve as a nice proof tool. For pure and lazy functional programming languages, they can be used with very few preconditions. Unfortunately, in the presence of selective strictness, as provided in languages like Haskell, their original strength is reduced. In this paper we present an approach for overcoming this weakness in specific situations. Employing a refined type system which tracks the use of enforced strict evaluation, we rule out unnecessary restrictions that otherwise emerge. Additionally, we provide (and implement) an algorithm determining all refined types for a given term.  相似文献   

15.
函数式语言并行化的方法   总被引:1,自引:0,他引:1  
Lisp作为一个表处理语言.有着悠久的历史,而COMMON LISP提供一r丰富的数据集和多程序设计模式:函数的,强制的和面向对象的〔“·幻。我们以COMMON LISP为蓝本完成T XJD一LISP/CLOS,它是为我国曙光一号机配备的.现已通过国家教委组织的鉴定。最近我们正在开发COMMON LISP的并行版本,作为863计划资助项目,这个工作很有意义。该并行系统将加速计算,并且还能对XJD一 LISP/CLOS提供支持。本文就函数式语言并行化的方法进行了探讨。  相似文献   

16.
The first-order, untyped, functional logic language Babel is extended by polymorphic types and higher order functios. A sophisticated incompatibility check which is used to guarantee nonambiguity of BABEL programs is presented. For the implementation of the language, unification and backtracking are integrated in a programmed (functional) graph reduction machine. The implementation of this machine has been used for a comparison between Babel and PROLOG based on the runtimes of some example programs.  相似文献   

17.
18.
一种带约束的多态类型系统   总被引:1,自引:0,他引:1  
本文讨论了一种带约束的多态类型系统,引入了约束类型,约束与全称量化的结合使得参数化多态函数的应用更安全,同时也为重工的表示和实现提供了一个新的途径,提高了类型表示的抽象度。本文讨论的类型系统具有两个不同层次的类型结构,约束的引入与肖去是不同层次上的操作,最后,本文人出了类型检查算法Wr,并证明了此算法中约束的可满足性是可判定的。  相似文献   

19.
We present an unboxed operational semantics for an ML-style polymorphic language. Different from the conventional formalisms, the proposed semantics accounts for actual representations of run-time objects of various types, and supports a refined notion of polymorphism that allows polymorphic functions to be applied directly to values of various different representations. In particular, polymorphic functions can receive multi-word constants such as floating-point numbers without requiring them to be boxed (i.e., heap allocated.) This semantics will serve as an alternative basis for implementing polymorphic languages. The development of the semantics is based on the technique of the type-inference-based compilation for polymorphic record operations [20]. We first develop a lower-level calculus, called a polymorphic unboxed calculus, that accounts for direct manipulation of unboxed values in a polymorphic language. This unboxed calculus supports efficient value binding through integer representation of variables. Different from de Bruijn indexes, our integer representation of a variable corresponds to the actual offset to the value in a run-time environment consisting of objects of various sizes. Polymorphism is supported through an abstraction mechanism over argument sizes. We then develop an algorithm that translates ML into the polymorphic unboxed calculus by using type information obtained through type inference. At the time of polymorphic let binding, the necessary size abstractions are inserted so that a polymorphic function is translated into a function that is polymorphic not only in the type of the argument but also in its size. The ML type system is shown to be sound with respect to the operational semantics realized by the translation.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号