第十二章 面向语言编程

728 篇文章 1 订阅
86 篇文章 0 订阅

第十二章 面向语言编程

 

在这一章,首先了解什么是面向语言的编程(language-oriented programming),许多人都在用,定义也各不相同。我们将主要讨论它的优点、不足;然后,再看F# 中面向语言编程的几种不同方法,这些方法包括使用 F# 文字创建“小语言”(little languages),使用 F# 引用(quotations),本章的大部分将讨论创建一种语言的示例,再创建一种解析器来运行这种语言;最后,再详细地讨论语言的运行,包括解释与编译运行的性能比较。

 

 

什么是面向语言编程?

 

虽然面向语言编程这个术语描述了许多不同的编程技术,但它们有一个共同的主题,即,对程序员来说,必须实现一种预定义的语言,是很常见的;通常是因为要从保存的消息、接收的字符串或者 XML 数据中提取结构化的数据,都要遵守这种预定义的语言。本章中介绍的的这些方法技术将有助于更可靠地完成。与此相关的思想就是小语言,也叫特定域语言(domain-specific languages DSLs)。需要创建 DSL 来解决问题,最好是这样的情况,即,创建一种自定义的语言来描述问题,然后,用这种语言去解决问题。函数编程总是和面向语言编程有紧密的联系,因为函数编程语言通常有这样的功能,非常适合于创建解析器和编译器。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Object-oriented programming, like most interesting new developments, builds on some old ideas, extends them, and puts them together in novel ways. The result is many-faceted and a clear step forward for the art of programming. An object-oriented approach makes programs more intuitive to design, faster to develop, more amenable to modifications, and easier to understand. It leads not only to new ways of constructing programs, but also to new ways of conceiving the programming task. Nevertheless, object-oriented programming presents some formidable obstacles to those who would like to understand what it’s all about or begin trying it out. It introduces a new way of doing things that may seem strange at first, and it comes with an extensive terminology that can take some getting used to. The terminology will help in the end, but it’s not always easy to learn. Moreover, there are as yet few full-fledged object-oriented development environments available to try out. It can be difficult to get started. That’s where this book comes in. It’s designed to help you become familiar with object-oriented programming and get over the hurdle its terminology presents. It spells out some of the implications of object-oriented design and tries to give you a flavor of what writing an object-oriented program is really like. It fully documents the Objective-C language, an object-oriented programming language based on standard C, and introduces the most extensive object- oriented development environment currently available—OPENSTEP.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值