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?

More than 5 years have passed since last update.

概要

ilasmでstack machineやってみた。
俺言語、コンパイラを作ってみた。
三段階の一段目を作ってみた。

ソースコード

10 a=0
20 a=a+1
30 #=a>100*255
40 b=a%15
50 #=b=0*120
60 b=a%5
70 #=b=0*140
80 b=a%3
90 #=b=0*160
100 ?=a
110 #=20
120 ?="fizzbuzz "
130 #=20
140 ?="buzz "
150 #=20
160 ?="fizz "
170 #=20

出力結果

	pushi	0
	set	a
label_20:
	get	a
	pushi	1
	+
	set	a
	get	a
	pushi	100
	if<	label_255
	get	a
	pushi	15
	%
	if	label_120
	get	a
	pushi	5
	%
	if	label_140
	get	a
	pushi	3
	%
	if	label_160
	get	a
	call	printi
	jp	label_20
label_120:
	push	"fizzbuzz "
	call	prints
	jp	label_20
label_140:
	push	"buzz "
	call	prints
	jp	label_20
label_160:
	push	"fizz "
	call	prints
	jp	label_20
label_255:
	ret

成果物

以上。

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?