Execute HQ9+: Difference between revisions

m
Line 302:
-export([main/1]).
 
%% bottle helper routine
hello() ->
io:format("Hello world!~n", []).
 
prog(Prog) ->
io:format("~s~n", [Prog]).
 
bottle(0) ->
io:format("No more bottles of beer ");
Line 316 ⟶ 311:
bottle(N) when N > 0 ->
io:format("~w bottles of beer ", [N]).
 
%% Implementation of instructions
beer(0) ->
bottle(0), io:format("on the wall~n"),
Line 327 ⟶ 323:
bottle(N-1), io:format("on the wall~n~n"),
beer(N-1).
 
hello() ->
io:format("Hello world!~n", []).
 
prog(Prog) ->
io:format("~s~n", [Prog]).
 
inc(Acc) ->
Acc+1.
 
%% Interpreter
execute(Instruction, Prog, Acc) ->
case Instruction of
Anonymous user