Post by r***@gmail.comTo my knowledge you can't "program in Glulx". Glulx is a virtual machine
that provides a platform for interactive fiction games. Inform 6 and 7
are two languages that compile to a format suitable for the Glulx platform.
Actually, you can program in Glulx, or, more specifically, using a
specific assembler, such as Glasm. I have written a few programs using
that assembler, including a Z-machine implementation in Glulx, as well
as partially a game called "Game of XYZABCDE -- Part II" (incomplete,
because I don't know what to put in, not because I can't program it;
I wrote about it in article <***@zzo38computer.org> if
you are interested). Another example of a Glulx code is listed here:
<!include ":glulx"
<!include ":glk"
!stack 256
:Prompt !string ">> "
!main 3
; Check if Glk supported; quit if not
gestalt gs.IOSystem,2,$
jz $,0
; Open window
!pushr 0,0,0,glk.wintype_TextBuffer,0
glk glk_window_open,5,$2
jz $2,0
push $2
glk glk_set_window,1,0
setiosys 2,0
; Main loop
; Check if number is -1 or 256
0h jne $0,-1,1f
2h copy 0,$0
1h jeq $0,256,2b
; Prompt and get input
streamstr Prompt
!pushr $2,Buf,1,0
glk glk_request_line_event,4,0
1h push Event
glk glk_select,1,0
jne @Etype,glk.evtype_LineInput,1b
jz @Eval1,0b
; Execute operation
copyb @Buf,$1
jeq $1,'i',I
jeq $1,'d',D
jeq $1,'s',S
jeq $1,'o',O
jump 0b
; Increment
:I add $0,1,$0
jump 0b
; Decrement
:D sub $0,1,$0
jump 0b
; Square
:S mul $0,$0,$0
jump 0b
; Output
:O streamnum $0
streamchar 10
jump 0b
!bss
:Event !allot 16
:Etype !is Event
:Ewin !is Event+4
:Eval1 !is Event+8
:Eval2 !is Event+12
:Buf !allot 8
(This program isn't really so useful; it is an implementation of the
rather worthless "Deadfish" esolang. It is just for demonstration.)
--
This signature intentionally left blank.
(But if it has these words, then actually it isn't blank, isn't it?)