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

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

by Tom Stuart
November 2017
Beginner to intermediate
344 pages
7h 2m
Chinese
GoTop Information, Inc.
Content preview from 深入理解運算原理|從簡單的機器到無所不能的程式
22
|
2
一如我們所預期,沒有『一種真正的方式』能解釋程式語言的語法要怎麼對應到潛在的
意義。實際上有好幾種不同的方式,可以具體討論程式的意義,所有的方式都在形式、
抽象、表現、實際效率之間有不同的折衷。我們將在後續幾節檢視幾種主要的形式之
道,並且討論它們彼此的關係。
操作語意學
思考程式意義最實際的方式就是
它能做什麼
。當我們執行程式時,我們期待會發生什
麼?程式語言裡的不同建構物在執行階段的行為會是如何?將它們接在一起而形成更大
的程式,又會有什麼效果?
這就是
操作語意
operational semantic
)的基礎,一種擷取程式語言意義的方式,而
這種方式是由程式如何在某種裝置執行的規則所定義。其中的裝置通常就是
抽象機
abstract machine
):虛構、理想化的電腦,為了解釋語言的程式將會如何執行的特定目
的而設計。為了精巧的擷取到它們執行階段的行為,不同類型的程式語言通常需要不同
設計的抽象機。
賦予了操作語意,就能相當嚴格且精確面對語言裡特定建構物的目的。不同於英文撰寫
的語言規格,那種規格可能隱含了模糊,並且忽略重要的邊緣案例;為了讓人信服語言
行為的傳達效果,形式操作規格必須明確且不能模糊。
小步語意
那麼,我們要如何設計抽象機,並以它來指定程式語言的操作語意?方式之一是想像有
種能直接在其語法操作估算程式的機器,以較少的步驟重複
化簡
reduce
)這部機器,
不論結果的意義,使其每一步驟都讓程式更接近它的最終結果。
這些小步驟化簡類似我們在學校學的代數運算式計算?舉例來說,若要計算 ...
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