Say
Jump to navigation
Jump to search
Say is an esolang invented by User:None1.
Syntax
Things in square brackets are optional, but if one is given, the others most be given too.
Variable: "[Yes/No, ]Variable2, it is Value[, not String]"
Value can be:
- A string (surrounded by single quotes), then the string is stored into Variable2
- A number, if it is i, then the i-th line (1-indexed) is jumped
what you think it isreads input as a string and stores the input into Variable2what you think it is notprints Variable2
If the thing in the brackets are given, the line is only executed if String==Variable2 if the word is Yes, and String!=Variable2 if the word is No.
Reading nonexistent variables result in empty strings, variables only exist when they are modified.
Examples
Hello, World!
A: "A, it is 'Hello, World!'" A: "A, it is what you think it is not"
Cat program
A: "A, it is what you think it is" A: "A, it is what you think it is not"
Truth Machine
A: "A, it is what you think it is" A: "A, it is what you think it is not" A: "No, A, it is 2, not '0'"
Interpreter
node.js->C++, with the unofficial extension of 'yes/no compares car1 with string and Um/Fuck compares var1 and var2':
code=`input code here`
Q='L:';c=`#include<bits/stdc++.h>
using namespace std;map<string,string>mp;int main(){`;
for(i of code.split`
`)if(S=/^(\w+): "(?:(?:(\w+), it is ('[^']*'|\d+|what you think it is(?: not)?))|(?:([Yy]es|[Nn]o|Um|Fuck), (\w+), it is ('[^']*'|\d+|what you think it is( not)?), not ('[^']*')))"$/m.exec(i)){
let v1=S[1],v2=S[2]??S[5],val=S[3]||S[6],l='{';S[8]=JSON.stringify(eval(S[8]));
if(S[4])switch(S[4]){case'Yes':l=`if(${S[8]}==mp["${v2}"]){`;break;
case'No':l=`if(${S[8]}!=mp["${v2}"]){`;break;
case'yes':l=`if(${S[8]}==mp["${v1}"]){`;break;
case'no':l=`if(${S[8]}!=mp["${v1}"]){`;break;
case'Um':l=`if(mp["${v1}"]==mp["${v2}"]){`;break;
case'Fuck':l=`if(mp["${v1}"]!=mp["${v2}"]){`;break;
}
if(val==`what you think it is`)l+='getline(cin,mp["'+v2+'"]);'
else if(val==`what you think it is not`)l+=`cout<<mp["${v2}"];`
else if(+val)l+=`goto ${'L'.repeat(val)};`
else l+=`mp["${v2}"]=${JSON.stringify(val)};`
c+=Q+l+'}';Q='L'+Q;
}
console.log(c+'}')