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

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

by Tom Stuart
November 2017
Beginner to intermediate
344 pages
7h 2m
Chinese
GoTop Information, Inc.
Content preview from 深入理解運算原理|從簡單的機器到無所不能的程式
68
|
3
同樣的,有限自動機沒有接收輸入的鍵盤、滑鼠、網路介面,只有每次能讀取一個輸入
字元的單一外部串流。
不同於可執行任意程式的通用型 CPU,每個有限自動機有 1 組已經寫死的
規則
rule),
這些規則決定了在回應輸入時,如何從某種狀態移到另 1 種狀態。此自動機在某種特定
狀態下啟動,並從它的輸入串流讀取個別的字元,遵循的規則是每次讀取 1 個字元。
以下是某種特定有限自動機架構的視覺化方式:
上圖兩個圓表示自動機的兩種狀態,也就是狀態 1 和狀態 2,而不知從何而來的箭頭表
示自動機始終從狀態 1 開始,這是它的
起始狀態
start state
)。 狀態之間的箭頭表示
機器的規則,它們是:
如果是在狀態 1,且讀取了字元 a,就轉成狀態 2
如果是在狀態 2,且讀取了字元 a,就轉成狀態 1
這些資訊已經足以讓我們研究此機器如何處理輸入串流:
此機器起始於狀態 1
此機器僅有從它的輸入串流讀取字元 a 的規則,因此那就是它唯一會發生的事情。
當它讀取 a 時,會從狀態 1 轉成狀態 2
當此機器讀取另一個 a,會轉回狀態 1
一旦轉回狀態 1,它就會開始重複自己,這也正是這個特定機器行為的範圍。關於目前
狀態的資訊,則假設是自動機的內部細節(它是當作『黑盒子』運作,不會揭露其內
部作業),所以它的徒勞無用加重了這種行為的無聊程度,不會造成任何類型的顯著輸
出。機器在狀態 12 之間反覆時,外部的世界沒有人能看到有任何事情發生,所以我
們在這種情況可能也有單一狀態,並且完全不會影響任何內部結構。 ...
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