3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

P言語でHello, Worldを書いてみる

Last updated at Posted at 2025-12-14
machine Main {
    start state Init {
        entry {
            print "Hello World!";
        }
    }
}

P言語は、Microsoft Researchによって開発された、非同期イベント駆動型システムを記述・検証するためのドメイン固有言語(DSL)です。

主に、並行処理や分散システムにおける複雑なバグ(競合状態やデッドロックなど)を、設計段階や実装前のテスト段階で徹底的に洗い出すために設計されています。Webサイトの簡単なバックエンドを作るような用途ではなく、OSのカーネル、クラウドのコア機能、組み込みシステムなど、高い信頼性が求められる並行システムの開発において真価を発揮します。

Hello, World!についても解説します。P言語はステートマシンを記述する言語なので、単に文字を表示するだけでもマシンと、その初期状態を定義する必要があります。
上記のHello, World!のソースコードでは、最初にMainというステートマシンを作り、そのマシンが初期状態(Init)に入ったとくにHello World!という文字列を出力する処理を書いています。

参考: https://p-org.github.io/P/

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?