Where is my esolang?

From Esolang
Jump to navigation Jump to search

yet another esolang by islptng

Syntax

i'm too busy to write detail here

where is my [name]? # [wait] = [name]

I've forgot where I put my [name] for the [number][st/nd/rd/th] time! # name <- number

let me think about it. after I used my [name] the last time... # while [name] > 0

...a-ha! it's there! # end while

it was [time]. # define label

what did I do at [time]? # goto label named [time]

# 'wait.' take the one used above as an argument
wait. what about my [name]? # [wait] - [name]
wait. is my [name] here? # name <- wait

I/O

mobile handles i/o
reading it calls a character input
writing to it outputs the value in ASCII

Examples

Print Hi! (too lazy to write Hello, world!)

I've forgot where I put my h for the 72nd time!
wait. is my mobile here?
I've forgot where I put my i for the 105th time!
wait. is my mobile here?
I've forgot where I put my exclamation for the 33rd time!
wait. is my mobile here?

Intepreters

as with a lot of my other interpreters, this is node.js->c++

code=`
I've forgot where I put my H for the 72nd time!
wait. is my mobile here?
I've forgot where I put my i for the 105th time!
wait. is my mobile here?
I've forgot where I put my exclamation for the 33rd time!
wait. is my mobile here?
`;//input code here

vn=x=>'v'+[...x].map(e=>e.charCodeAt()).join`_`;
ln=x=>'l'+[...x].map(e=>e.charCodeAt()).join`_`;
console.log(`#include<bits/stdc++.h>
#define int int64_t
using namespace std;int wait,${vn('mobile')};signed main(){
`,code.split`
`.map(e=>{let tmp;e=e.trim();
if(tmp=/^where is my (.+)\?$/i.exec(e))return`wait=${vn(tmp[1])};`
if(tmp=/^wait\. is my (.+) here\?$/i.exec(e))return`${vn(tmp[1])}=wait;${tmp[1]=='mobile'?'putchar(wait);':''}`
if(tmp=/^wait\. what about my (.+)\?$/i.exec(e))return`wait-=${vn(tmp[1])};`;
if(tmp=/^let me think about it\. after I used my (.+) the last time\.\.\.$/i.exec(e))return`while(${vn(tmp[1])}>0){`;
if('...a-ha! it\'s there!'===e.toLowerCase())return`}`;
if(tmp=/^it was (.+)\.$/i.exec(e))return`;${ln(tmp[1])}:`;
if(tmp=/^I've forgot where I put my (.+) for the (\d+)(st|nd|rd|th) time!$/i.exec(e))return`wait=${vn(tmp[1])}=${tmp[2]};`;
if(tmp=/^what did I do at (.+)\.$/i.exec(e))return`;goto ${ln(tmp[1])};`;
return`/*Comment: ${e}*/;`;
}).join`
`,'return 0;}');