首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到15条相似文献,搜索用时 125 毫秒
1.
Monad作为构造纯函数式语言的工具,能构造出诸如错误处理、状态、IO等非纯函数式语言的特征。该文通过组合状态转换Monad和异常处理Monad来定义纯函数式语言通道系统操作,给出了通道系统操作的操作语义。  相似文献   

2.
状态、输入和输出是Z规范的基础,引入Monad的纯函数式语言特别适合用来实现用Z规范说明的系统.通过将状态、输入和输出封装在一个Monad内,提出一种基于Z规范的纯函数式程序设计方法.  相似文献   

3.
吕江花  金成植 《软件学报》2003,14(12):1989-1995
Monad程序的核心是一组Monad定义.Monad定义分为MAP型和BIND型.如果在Monad库中已有所需要的Monad定义型,则可以直接使用,而不需要重新构造;否则,需要重新构造.但如果在Monad程序设计环境中增加从一类Monad构造另一类Monad的自动生成器,那么既方便了用户也扩充了1倍原有的Monad库.鉴于这种思想,用支持Monad程序设计的高阶函数语言Haskell实现了一个Monad的自动生成系统.另外,用户构造Monad不仅要花费较多的时间,而且写出的Monad多态函数往往不满足Monad所需满足的几条公理,因此,从这方面也可以看出,从一种类型的Monad自动产生另一种类型的Monad的重要意义.  相似文献   

4.
采用unboxed数据类型实现纯函数式I/O系统,通过一个由unboxed数据类型定义的程序转换系统将纯函数式I/O程序转换为C语言代码,其中着重讨论了基本操作ccall的实现.  相似文献   

5.
袁华强  孙永强 《软件学报》1997,8(A00):189-193
纯函数式语言缺乏处理非确定性功能,本文给出了一个非确定性Monad,用此Monad在纯函数式语言中加入了非确定性处理功能,描述卫个基于非确定性Monad的纯函数式树搜索算法,并证明了一些有用的代数性质。  相似文献   

6.
本文通过状态转换器来定义I/O的文件系统,并用非确定性Monad描述了操作系统的进程同,从而给出了通道系统的语义。  相似文献   

7.
采用一种基于范畴论发展出来的Monad的实现方法,该方法可从编译器中提取操作性语义,然后将其等价转换为指示性语义。由于Monad方法普遍适用于函数式编程语言,使得基于Monad的可认证数据结构可根据源语言的语法生成新语言特性。优点是新语言特性的设计者无须深入了解修改编译器语法树,也无须修改源语言的语法,即可完成程序语言编译器之间语义的移植。  相似文献   

8.
纯函数式语言缺乏处理非确定性的功能,本文给出了一个非确定性Monad,用此Monad在纯函数式语言中描述了非确定性进程网,证明了一些有用的代数性质。  相似文献   

9.
袁华强  孙永强 《软件学报》1996,7(11):683-690
PhilipWadler在探讨用Monad构造纯函数式程序时,介绍了一个简单的词法分析程序的构造过程.本文进一步研究了这种方法,并用这种方法构造出一个能进行复杂的layout分析、词法分析与语法分析的纯函数式分析程序.  相似文献   

10.
函数式语言中的赋值语句   总被引:7,自引:0,他引:7  
文章探讨了怎样在纯函数式语言中加入赋值操作,而又不丧失引用透明性特征的问题,给出了这些操作的指称语义,并用这些赋值操作定义了一个简单的命令式语言的解释程序.  相似文献   

11.
Compilers and optimizers for declarative query languages use some form of intermediate language to represent user-level queries. The advent of compositional query languages for orthogonal type systems (e.g., OQL) calls for internal query representations beyond extensions of relational algebra. This work adopts a view of query processing which is greatly influenced by ideas from the functional programming domain. A uniform formal framework is presented which covers all query translation phases, including user-level query language compilation, query optimization, and execution plan generation. We pursue the type-based design—based on initial algebras—of a core functional language which is then developed into an intermediate representation that fits the needs of advanced query processing. Based on the principle of structural recursion we extend the language by monad comprehensions (which provide us with a calculus-style sublanguage that proves to be useful during the optimization of nested queries) and combinators (abstractions of the query operators implemented by the underlying target query engine). Due to its functional nature, the language is susceptible to program transformation techniques that were developed by the functional programming as well as the functional data model communities. We show how database query processing can substantially benefit from these techniques.  相似文献   

12.
Constructs for expressing exception handling can greatly help to avoid clutter in code by allowing the programmer to separate the code to handle unusual situations from the code for the normal case. The author proposes a new approach to embed exception handlers in functional languages. The proposed approach discards the conventional view of treating exceptions, as a means of effecting a control transfer; instead, exceptions are used to change the state of an object. The two types of exceptions, terminate and resume, are treated differently. A terminate exception, when raised, is viewed as shielding the input object. On the other hand, a resume exception designates the input object as curable and requires the immediate application of a handler function. This approach enables the clean semantics of functions raising exceptions without associating any implementation restriction and without loss of the referential transparency and the commutativity properties of functions  相似文献   

13.
14.
This paper reports on the memory performance of parallel scientific algorithms, written in both pure and impure functional styles. The Id programming language is used, since it allows both pure and impure parallel functional programs to be expressed. The non-strict storage model of Id is introduced. The study focuses on two algorithms: the Dongarra Sorensen Eignensolver and the NAS FT three dimensional heat equation solver, based on FFTs.This study verifies the claim that functional languages allow a composition of programs from modules, exploiting the inter- and intra-module parallelism without the need for rewrinting these modules. But it also shows that memory use of pure functional programs can be excessive, and theat impure functional programs can be as memory-efficient as imperative implementations.  相似文献   

15.
基于模态的嵌入式软件动态重构技术研究   总被引:1,自引:0,他引:1  
覃杨森  董云卫 《计算机科学》2012,39(2):179-182,190
终结共代数上的互模拟是等价关系,这一性质为对象的行为等价提供了一种基于共归纳原理的证明方法。首先,利用共代数给出面向对象方法中的抽象类、类和对象的形式化描述,其中抽象类被定义为一个包含方法和断言声明的类规范,类被定义为满足类规范的共代数,类的各个对象看成是共代数状态空间上的元素,而对象中方法的各种行为结构则通过强Monads进行参数化描述;接着,利用类规范的终结共代数给出对象行为等价关系的证明方法以及在各种不同Monads结构下的终结共代数语义;最后,通过实例说明如何利用PVS工具对研究结果进行验证。  相似文献   

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

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