Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program foo
- implicit none
- integer, parameter :: stack_max = 1000
- integer :: stack(0:stack_max - 1)
- integer :: sp = 0 ! "Stack pointer"
- integer :: var0 = 0
- integer :: var1 = 0
- integer :: var2 = 0
- integer :: var3 = 0
- integer :: var4 = 0
- integer :: var5 = 0
- integer :: var6 = 0
- integer :: var7 = 0
- integer :: var8 = 0
- integer :: var9 = 0
- integer :: var10 = 0
- integer :: var11 = 0
- integer :: var12 = 0
- integer :: var13 = 0
- integer :: var14 = 0
- goto 10000
- 10000 continue
- if (stack_max <= sp) error stop
- stack(sp) = 420
- sp = sp + 1
- goto 10010
- 10010 continue
- if (sp <= 0) error stop
- stack(sp - 1) = -stack(sp - 1)
- goto 10020
- 10020 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var0 = stack(sp)
- goto 10030
- 10030 continue
- if (stack_max <= sp) error stop
- stack(sp) = 300
- sp = sp + 1
- goto 10040
- 10040 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var1 = stack(sp)
- goto 10050
- 10050 continue
- if (stack_max <= sp) error stop
- stack(sp) = 300
- sp = sp + 1
- goto 10060
- 10060 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var2 = stack(sp)
- goto 10070
- 10070 continue
- if (stack_max <= sp) error stop
- stack(sp) = 300
- sp = sp + 1
- goto 10080
- 10080 continue
- if (sp <= 0) error stop
- stack(sp - 1) = -stack(sp - 1)
- goto 10090
- 10090 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var3 = stack(sp)
- goto 10100
- 10100 continue
- if (stack_max <= sp) error stop
- stack(sp) = 7
- sp = sp + 1
- goto 10110
- 10110 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var4 = stack(sp)
- goto 10120
- 10120 continue
- if (stack_max <= sp) error stop
- stack(sp) = 15
- sp = sp + 1
- goto 10130
- 10130 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var5 = stack(sp)
- goto 10140
- 10140 continue
- if (stack_max <= sp) error stop
- stack(sp) = 200
- sp = sp + 1
- goto 10150
- 10150 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var6 = stack(sp)
- goto 10160
- 10160 continue
- if (stack_max <= sp) error stop
- stack(sp) = var2
- sp = sp + 1
- goto 10170
- 10170 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var7 = stack(sp)
- goto 10180
- 10180 continue
- if (stack_max <= sp) error stop
- stack(sp) = var7
- sp = sp + 1
- goto 10190
- 10190 continue
- if (stack_max <= sp) error stop
- stack(sp) = var3
- sp = sp + 1
- goto 10200
- 10200 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = b2i (stack(sp - 1) > stack(sp))
- goto 10210
- 10210 continue
- if (sp <= 0) error stop
- sp = sp - 1
- if (stack(sp) == 0) goto 11030
- goto 10220
- 10220 continue
- if (stack_max <= sp) error stop
- stack(sp) = var0
- sp = sp + 1
- goto 10230
- 10230 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var8 = stack(sp)
- goto 10240
- 10240 continue
- if (stack_max <= sp) error stop
- stack(sp) = var8
- sp = sp + 1
- goto 10250
- 10250 continue
- if (stack_max <= sp) error stop
- stack(sp) = var1
- sp = sp + 1
- goto 10260
- 10260 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = b2i (stack(sp - 1) < stack(sp))
- goto 10270
- 10270 continue
- if (sp <= 0) error stop
- sp = sp - 1
- if (stack(sp) == 0) goto 10960
- goto 10280
- 10280 continue
- if (stack_max <= sp) error stop
- stack(sp) = 0
- sp = sp + 1
- goto 10290
- 10290 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var9 = stack(sp)
- goto 10300
- 10300 continue
- if (stack_max <= sp) error stop
- stack(sp) = 0
- sp = sp + 1
- goto 10310
- 10310 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var10 = stack(sp)
- goto 10320
- 10320 continue
- if (stack_max <= sp) error stop
- stack(sp) = 32
- sp = sp + 1
- goto 10330
- 10330 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var11 = stack(sp)
- goto 10340
- 10340 continue
- if (stack_max <= sp) error stop
- stack(sp) = 0
- sp = sp + 1
- goto 10350
- 10350 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var12 = stack(sp)
- goto 10360
- 10360 continue
- if (stack_max <= sp) error stop
- stack(sp) = var12
- sp = sp + 1
- goto 10370
- 10370 continue
- if (stack_max <= sp) error stop
- stack(sp) = var6
- sp = sp + 1
- goto 10380
- 10380 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = b2i (stack(sp - 1) < stack(sp))
- goto 10390
- 10390 continue
- if (sp <= 0) error stop
- sp = sp - 1
- if (stack(sp) == 0) goto 10890
- goto 10400
- 10400 continue
- if (stack_max <= sp) error stop
- stack(sp) = var10
- sp = sp + 1
- goto 10410
- 10410 continue
- if (stack_max <= sp) error stop
- stack(sp) = var10
- sp = sp + 1
- goto 10420
- 10420 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) * stack(sp)
- goto 10430
- 10430 continue
- if (stack_max <= sp) error stop
- stack(sp) = 200
- sp = sp + 1
- goto 10440
- 10440 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) / stack(sp)
- goto 10450
- 10450 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var13 = stack(sp)
- goto 10460
- 10460 continue
- if (stack_max <= sp) error stop
- stack(sp) = var9
- sp = sp + 1
- goto 10470
- 10470 continue
- if (stack_max <= sp) error stop
- stack(sp) = var9
- sp = sp + 1
- goto 10480
- 10480 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) * stack(sp)
- goto 10490
- 10490 continue
- if (stack_max <= sp) error stop
- stack(sp) = 200
- sp = sp + 1
- goto 10500
- 10500 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) / stack(sp)
- goto 10510
- 10510 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var14 = stack(sp)
- goto 10520
- 10520 continue
- if (stack_max <= sp) error stop
- stack(sp) = var13
- sp = sp + 1
- goto 10530
- 10530 continue
- if (stack_max <= sp) error stop
- stack(sp) = var14
- sp = sp + 1
- goto 10540
- 10540 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) + stack(sp)
- goto 10550
- 10550 continue
- if (stack_max <= sp) error stop
- stack(sp) = 800
- sp = sp + 1
- goto 10560
- 10560 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = b2i (stack(sp - 1) > stack(sp))
- goto 10570
- 10570 continue
- if (sp <= 0) error stop
- sp = sp - 1
- if (stack(sp) == 0) goto 10700
- goto 10580
- 10580 continue
- if (stack_max <= sp) error stop
- stack(sp) = 48
- sp = sp + 1
- goto 10590
- 10590 continue
- if (stack_max <= sp) error stop
- stack(sp) = var12
- sp = sp + 1
- goto 10600
- 10600 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) + stack(sp)
- goto 10610
- 10610 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var11 = stack(sp)
- goto 10620
- 10620 continue
- if (stack_max <= sp) error stop
- stack(sp) = var12
- sp = sp + 1
- goto 10630
- 10630 continue
- if (stack_max <= sp) error stop
- stack(sp) = 9
- sp = sp + 1
- goto 10640
- 10640 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = b2i (stack(sp - 1) > stack(sp))
- goto 10650
- 10650 continue
- if (sp <= 0) error stop
- sp = sp - 1
- if (stack(sp) == 0) goto 10680
- goto 10660
- 10660 continue
- if (stack_max <= sp) error stop
- stack(sp) = 64
- sp = sp + 1
- goto 10670
- 10670 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var11 = stack(sp)
- goto 10680
- 10680 continue
- if (stack_max <= sp) error stop
- stack(sp) = var6
- sp = sp + 1
- goto 10690
- 10690 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var12 = stack(sp)
- goto 10700
- 10700 continue
- if (stack_max <= sp) error stop
- stack(sp) = var10
- sp = sp + 1
- goto 10710
- 10710 continue
- if (stack_max <= sp) error stop
- stack(sp) = var9
- sp = sp + 1
- goto 10720
- 10720 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) * stack(sp)
- goto 10730
- 10730 continue
- if (stack_max <= sp) error stop
- stack(sp) = 100
- sp = sp + 1
- goto 10740
- 10740 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) / stack(sp)
- goto 10750
- 10750 continue
- if (stack_max <= sp) error stop
- stack(sp) = var7
- sp = sp + 1
- goto 10760
- 10760 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) + stack(sp)
- goto 10770
- 10770 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var9 = stack(sp)
- goto 10780
- 10780 continue
- if (stack_max <= sp) error stop
- stack(sp) = var13
- sp = sp + 1
- goto 10790
- 10790 continue
- if (stack_max <= sp) error stop
- stack(sp) = var14
- sp = sp + 1
- goto 10800
- 10800 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) - stack(sp)
- goto 10810
- 10810 continue
- if (stack_max <= sp) error stop
- stack(sp) = var8
- sp = sp + 1
- goto 10820
- 10820 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) + stack(sp)
- goto 10830
- 10830 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var10 = stack(sp)
- goto 10840
- 10840 continue
- if (stack_max <= sp) error stop
- stack(sp) = var12
- sp = sp + 1
- goto 10850
- 10850 continue
- if (stack_max <= sp) error stop
- stack(sp) = 1
- sp = sp + 1
- goto 10860
- 10860 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) + stack(sp)
- goto 10870
- 10870 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var12 = stack(sp)
- goto 10880
- 10880 continue
- goto 10360
- 10890 continue
- if (stack_max <= sp) error stop
- stack(sp) = var11
- sp = sp + 1
- goto 10900
- 10900 continue
- if (sp <= 0) error stop
- sp = sp - 1
- write (*, '(A1)', advance = 'no') achar (stack(sp))
- goto 10910
- 10910 continue
- if (stack_max <= sp) error stop
- stack(sp) = var8
- sp = sp + 1
- goto 10920
- 10920 continue
- if (stack_max <= sp) error stop
- stack(sp) = var4
- sp = sp + 1
- goto 10930
- 10930 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) + stack(sp)
- goto 10940
- 10940 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var8 = stack(sp)
- goto 10950
- 10950 continue
- goto 10240
- 10960 continue
- if (stack_max <= sp) error stop
- stack(sp) = 10
- sp = sp + 1
- goto 10970
- 10970 continue
- if (sp <= 0) error stop
- sp = sp - 1
- write (*, '(A1)', advance = 'no') achar (stack(sp))
- goto 10980
- 10980 continue
- if (stack_max <= sp) error stop
- stack(sp) = var7
- sp = sp + 1
- goto 10990
- 10990 continue
- if (stack_max <= sp) error stop
- stack(sp) = var5
- sp = sp + 1
- goto 11000
- 11000 continue
- if (sp <= 1) error stop
- sp = sp - 1
- stack(sp - 1) = stack(sp - 1) - stack(sp)
- goto 11010
- 11010 continue
- if (sp <= 0) error stop
- sp = sp - 1
- var7 = stack(sp)
- goto 11020
- 11020 continue
- goto 10180
- 11030 continue
- goto 11040
- 11040 continue ! End of program.
- contains
- ! Boolean to integer:
- elemental function b2i (b) result (i)
- logical, intent(in) :: b
- integer :: i
- if (b) then
- i = 1
- else
- i = 0
- end if
- end function b2i
- ! Integer to boolean:
- elemental function i2b (i) result (b)
- integer, intent(in) :: i
- logical :: b
- b = (i /= 0)
- end function i2b
- subroutine write_pool_string (i)
- integer, intent(in) :: i
- character(len = :), allocatable :: s
- select case (i)
- case default
- error stop
- end select
- write (*, '(A)', advance = 'no') s
- end subroutine write_pool_string
- end program foo
Advertisement
Comments
-
- Compile in GNU Fortran like so: gfortran -g -fbounds-check -O2 foo.f90 -o foo
-
- Hello from Spain bro!
Add Comment
Please, Sign In to add comment
Advertisement