Task

Implement a    HQ9+    interpreter or compiler.




PROC Run(CHAR ARRAY code)
  BYTE i,a
  CHAR c
 
  PrintF("Run ""%S""%E%E",code)
  a=0
  FOR i=1 TO code(0)
  DO
    c=code(i)
    IF c='q OR c='Q THEN
      PrintE(code)
    ELSEIF c='h OR c='H THEN
      PrintE("Hello, world!")
    ELSEIF c='9 THEN
      PrintE("99 bottles here...")
    ELSEIF c='+ THEN
      a==+1
    ELSE
      PrintF("Unrecognized character '%C'%E",c)
      Break()
    FI
  OD
  PrintF("%EAccumulator=%B%E",a)
RETURN
 
PROC Main()
  Run("9++hQ+q9H+")
RETURN