file IO in Lolcode

577 views
Skip to first unread message

Nick Heijmink

unread,
Mar 19, 2013, 7:50:49 AM3/19/13
to lci-g...@googlegroups.com
Hi,
for a research project for semantics i chose to observe lolcode.
one of the subjects I wanted to work out in natural semantics was the file io system but i can´t get this functioning.
this is the basic code i have

HAI 1.2
CAN HAS STDIO?
PLZ TRY OPEN FILE "lolz.txt"?
     AWSUM THX
           VISIBLE FILE
     OHS NOES
           VISIBLE "OMG ERROR!"
     ANYWAYZ
           VISIBLE "LOL, filehandling over!"
KTHXBYE

Justin J. Meza

unread,
Mar 19, 2013, 11:47:30 AM3/19/13
to lci-g...@googlegroups.com
Hi Nick,

That is great that you are interested in taking a principled approach to
developing the file I/O semantics for LOLCODE! The current way of doing things
is quite hacked together.

I think the syntax you are using was from an old proposal. What is currently
implemented in the future branch on lci (at
https://github.com/justinmeza/lci/tree/future) uses some of the features of
BUKKITs in the 1.3 spec, and works like this (assuming the file is called
"libtest.lol", it opens itself, reads and prints its first 7 bytes, "HAI 1.3",
and closes itself):

HAI 1.3
CAN HAS STDIO?
I HAS A file
file R I IZ STDIO'Z FOPENIN YR "libtest.lol" AN YR "r" MKAY
I HAS A str ITZ I IZ STDIO'Z FREADIN YR file AN YR 7 MKAY
VISIBLE str
I IZ STDIO'Z FCLOSIN YR file MKAY
KTHXBYE

If you want to play around with the grammar, you can change the tokenizer and
parser files. Most of the code that handles file I/O is in the binding source
code files.

- Justin
> --
> You received this message because you are subscribed to the Google Groups "lci-general" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to lci-general...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages