0
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?

プロデル、調査 その110

Last updated at Posted at 2025-08-06

概要

プロデルが、CLRらしいので、調べて見た。
練習問題やってみた。

練習問題

真理値表を出力するインタープリターを書け。

サンプルコード


[ソース]を、真理値表する手順
	マップは{}
	文は、ソースを「
」で区切ったもの
	文を行へそれぞれ繰り返す
		項目は、行を、「 」で区切ったもの
		項目(1)について分岐
		「lin」の場合
			【n:整数】は、項目(2)
			縦を1からnまで増やしながら繰り返す
				マップ(縦)は{}
				横を1からnまで増やしながら繰り返す
					マップ(縦)(横)は、0
				そして
			そして
		「code」の場合
			【c:整数】は、項目(3)
			項目(2)について分岐
			「00」の場合
				マップ(1)(1)は、c
			「01」の場合
				マップ(1)(2)は、c
			「02」の場合
				マップ(2)(1)は、c
			「03」の場合
				マップ(2)(2)は、c
			その他の場合
			そして
		その他の場合
		そして
	そして
	「A B C」を出力して改行
	「------」を出力して改行
	「0 0 [マップ(1)(1)]」を出力して改行
	「0 1 [マップ(1)(2)]」を出力して改行
	「1 0 [マップ(2)(1)]」を出力して改行
	「1 1 [マップ(2)(2)]」を出力して改行
終わり

「
lut 3
lin 2
lout 1
code 00 00
code 01 01
code 02 01
code 03 00
」を、真理値表する




実行結果

A B C
------
0 0 0
0 1 1
1 0 1
1 1 0

以上。

0
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
0
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?