Skip to Content
深入理解運算原理|從簡單的機器到無所不能的程式
book

深入理解運算原理|從簡單的機器到無所不能的程式

by Tom Stuart
November 2017
Beginner to intermediate
344 pages
7h 2m
Chinese
GoTop Information, Inc.
Content preview from 深入理解運算原理|從簡單的機器到無所不能的程式
52
|
2
這種語意的風格完全不直接解決執行程式的問題,反之,為了解釋新語言,它本身關心的
是另一種語言既定意義的影響(一種比描述的語言更低階、更形式,或至少更好瞭解)。
指稱語意一定是比操作語意更抽象的作法,因為它只是換掉語言而已,並沒有將語言轉
變成真實的行為。舉例來說,如果我們必須向沒有共通語言的某人解釋英文動詞 "walk"
的意思,可以用操作的方式來溝通,也就是實際的來回走動。另一方面,如果我們需
要向說法文的人解釋 "walk",我們可以用指稱的方式,也就是以法文動詞
marcher
來說
明,這是一種無法爭辯的更高層次的溝通形式,不需要混亂的練習。
雖然指稱語意通常用在程式轉換成數學物件,這並不讓人意外(因此能以數學工具來研
究和操作它們),但是我們可藉由查看如何以某種其他方式來指示 SIMPLE 程式而獲得
這種方法的若干風味。
讓我們將 SIMPLE 轉譯成 Ruby,來試著找出 SIMPLE 的指稱語意
16
。實際上這意謂著
將抽象語法樹轉換成以某種方式擷取該語法本意的 Ruby 程式碼字串。
但何謂『本意』呢? Ruby 指稱的運算式和陳述式的外貌應該為何?我們已經看過運算式
拿取環境並將它轉成值的操作;在 Ruby 呈現的方式之一,是以 proc 拿取一些表示環境
引數的引數,並傳回一些表示值的 Ruby 物件。對簡單的常數運算式像是
«5»
«false»
來說,我們完全不會使用環境,所以只需要擔心它最後的結果要如何表示成 Ruby 物件。
幸運的是,Ruby 已經有了特別為表示這些值而設計的物件:我們可以使用 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JSON實務手冊

JSON實務手冊

Tom Marrs

Publisher Resources

ISBN: 9789864766000