It really is the greatest thing since sliced strings.
- Code: Select all
OCOBOL >>SOURCE FORMAT IS FIXED
*> ***************************************************************
*> Purpose: Demonstrate libguile bf interactions
*> Tectonics: cobc -x -lguile-2.0 derps.cob
*> ***************************************************************
identification division.
program-id. derps.
data division.
working-storage section.
77 derps pic x(124) value
"+++++ +++++ [ > +++++ ++ > +++++ +++ > + <<< - ] >" &
- " -- . + . > ++ . -- . > . > , [ <<< - . + . " &
- "> ++ . -- . > . > - ]".
77 scm-result usage pointer.
*> ***************************************************************
procedure division.
call "scm_init_guile" end-call
*> eval-string in bf context, res is unspecified
call "scm_c_eval_string"
using function concatenate(
"(use-modules (ice-9 eval-string))"
'(define derps "' derps '")'
"(define res (eval-string derps #:lang 'brainfuck))"
low-value)
returning scm-result
on exception display function exception-location end-display
end-call
goback.
end program derps.
which runs as
- Code: Select all
$ cobc -x derps.cob -lguile-2.0
$ ./derps
DERP
^E
DERP
DERP
DERP
DERP
DERP
$
COBOL in charge of Guile, running brainf**k code, all for the DERP.
COBOL rules. Admit it, it won a long time ago, still winning.
Cheers,
Brian
