Execute HQ9+: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 294:
 
<lang ela>each writen <| eval "HQ9+"</lang>
 
=={{header|Forth}}==
 
<lang forth>variable accumulator
: H cr ." Hello, world!" ;
: Q cr 2dup type ;
: 9 99 verses ; \ http://rosettacode.org/wiki/99_Bottles_of_Beer#Forth
: + 1 accumulator +! ;
 
: hq9+ ( "code" -- )
parse-word 2dup bounds ?do
i 1 [ get-current literal ] search-wordlist
if execute else true abort" invalid HQ9+ instruction"
then loop 2drop ;</lang>
 
 
 
 
Line 340 ⟶ 324:
io:format("~n"),
bottle(N), io:format("of beer on the wall~n"),
bottle(N), io:format("of beer~nTake one down and pass it around~n"),
bottle(N-1), io:format("of beer on the wall~n"),
beer(N-1).
 
inc(Acc) ->
Line 374 ⟶ 358:
 
}</lang>
 
 
=={{header|Forth}}==
 
<lang forth>variable accumulator
: H cr ." Hello, world!" ;
: Q cr 2dup type ;
: 9 99 verses ; \ http://rosettacode.org/wiki/99_Bottles_of_Beer#Forth
: + 1 accumulator +! ;
 
: hq9+ ( "code" -- )
parse-word 2dup bounds ?do
i 1 [ get-current literal ] search-wordlist
if execute else true abort" invalid HQ9+ instruction"
then loop 2drop ;</lang>
 
 
 
Anonymous user