I'm trying to make my own programming language, but its not going that well. Some commands work, but other ones don't, and I don't understand why.
This is the script I use to create the programming language:
var result;
convert("popup:['hi']; get:['#hello']:hide;");
function convert(text) {
result = text;
a("popup:", "alert");
a("[", "(");
a("]", ")");
a("get:", "document.querySelector");
a(":hide", ".style.display = 'none'");
a(":show", ".style.display = 'block'");
a(":html:", ".innerHTML = ");
eval(result);
}
function a(text, textb) {
result = result.replace(text, textb);
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Blank template</title>
<!-- Load external CSS styles -->
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1 id="hello">hello there</h1>
<!-- Load external JavaScript -->
<script src="index.js"></script>
</body>
</html>