Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/proggles/ Challenge: VARPRINT

Name: Anonymous 2019-01-29 18:13

Implement a simple language with two operations, VAR and PRINT, with strings are its only data-type. Here’s a program in that language:

VAR name "Anii"
VAR name2 name
VAR name "My"
PRINT "Hack" name name2


Running this program on a correct implementation of our spec should output "Hack My Anii".

Here's a spec for the operations:

VAR <identifier> <value> variable assignment - after this runs, references to identifier will evaluate to value
PRINT <value> ... <value> prints the values of previously assigned variables, or string literals, space separated

Program will input a VARPRINT program and output the result of running it.

Name: Anonymous 2019-01-29 18:22

how should we take input? stdin? filename passed as a command-line arg? whatever we want?

Name: Anonymous 2019-01-29 18:46

>>2
Stdin or any reasonable equivalent should your language not support stdin.

Name: Anonymous 2019-01-29 22:10

This would be technically Touring complete

Name: Anonymous 2019-01-29 22:47

>>4
No, it would not.

Name: Anonymous 2019-01-30 1:19

I'm an emacs user who would be happier using vscode except that accessing documentation about how vscode is implemented requires a live web connection, and I try to minimize the amount of time I spend connected to the web.
I do my Emacs-Lisp hacking offline, which is possible because the emacs-lisp reference manual and other useful resources (e.g., the entirety of emacswiki.org as a directory of MediaWiki markup files) can be downloaded with a single command line. In contrast it is too hard to find and render locally usable collections of vscode, typescript, Electron or JavaScript documentation larger than individual web pages.

There are many aspects of my life that require me to be on the web, but I HATE THE WEB and would put up with a lot to avoid making yet another regular activity of mine dependent on my being connected to the web.

There is no net connection in my apartment these days (though there is in some of the common rooms in my apartment building) and I do all my emacs hacking in my apartment.

I long ago got used to making a constant series of small modifications to my emacs environment. Although I might choose to refrain from getting into the habit of doing that if I could live my life over again, it wouldnt make sense for me to unlearn that habit at this late stage of my life, which explains why i would regularly need access to documentation on how vscode is implemented if I were to replace emacs with vscode.

I used to like the web, in the 1990s and later, but it has slowly changed into something I hate. HTML 5 for example severely diminished my experience of the web.

Name: Anonymous 2019-01-30 16:21

$ echo -e "#include <stdio.h>\nint main(void){\n$(cat)\nreturn 0;}" | sed --expression='s/^VAR/#define/g' | sed -r --expression='s/^PRINT(.*)/puts(\1);/g' |
gcc -xc - && ./a.out

HackMyMy

Name: Anonymous 2019-01-31 18:02

>>5
VAR is basically MOV and MOV is touring complete

Name: Anonymous 2019-01-31 18:09

>>8
MOV is turing complete on x86 only because x86 itself is a bloated CISC. VAR in VARPRINT does not have the abilities of x86 mov.

Name: Anonymous 2019-02-01 15:23

I've seen this before…

https://timr.co/compiling-interpreted-languages
there it is.

Name: Anonymous 2019-02-01 15:49

>>10
Rude

Name: Pavel Graham 2019-02-01 18:43

>>10
Get the fuck back to hacker news, will you?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List