用于寫交互式小說的 Inform 7 編程語言正式開源
Inform 7 是一種使用自然語言語法創建交互式小說的編程語言,曾多次躋身 TIOBE 指數編程語言前 100 之列。目前,Inform 7 編程語言及其組件已正式宣布在 GitHub 上基于 Artistic License 開源。
Inform 本身是一種用于制作交互式小說的編程語言和設計系統,最初由 Graham Nelson 于 1993 年創建。 而 Inform 7 誕生于 2006 年 4 月 , 基于基礎的 Inform 作了進一步抽象,使編譯器能進一步推斷句子的含義。
Inform 7 由三個主要部分組成:專門用于測試交互式小說的開發工具 Inform 7 IDE 、用于編譯語言的 Inform 7 編譯器,以及構成 Inform 7 核心庫的“標準規則”。
Inform 7 被廣泛用于文學寫作、游戲行業原型制作工具等場景,它使用自然語言,并借鑒語言學和文學編程的思想,而代碼語句則采用完整句子的形式,在結構上注重空行和縮進。下面是一段代碼示例:
"Hello Deductible" by "I.F. Author"
The story headline is "An Interactive Example".
The Living Room is a room. "A comfortably furnished living room."
The Kitchen is north of the Living Room.
The Front Door is south of the Living Room.
The Front Door is a door. The Front Door is closed and locked.
The insurance salesman is a man in the Living Room. The description is "An insurance salesman in a tacky polyester suit. He seems eager to speak to you." Understand "man" as the insurance salesman.
A briefcase is carried by the insurance salesman. The description is "A slightly worn, black briefcase." Understand "case" as the briefcase.
The insurance paperwork is in the briefcase. The description is "Page after page of small legalese." Understand "papers" or "documents" or "forms" as the paperwork.
Instead of listening to the insurance salesman:
say "The salesman bores you with a discussion of life insurance policies. From his briefcase he pulls some paperwork which he hands to you.";
move the insurance paperwork to the player.
Inform 本身是一個軟件,但開源的并不是單個程序,而是程序和資源的集合,目前 Inform 7 的 GitHub 倉庫包含大量基礎組件、資源文檔、代碼示例,感興趣的朋友可以前去了解。
本文轉自OSCHINA
本文標題:用于寫交互式小說的 Inform 7 編程語言正式開源
本文地址:https://www.oschina.net/news/193544/inform-7-open-source