From d163581085b57abd84e22cdabc86b5799f4eb388 Mon Sep 17 00:00:00 2001 From: Linus Lee Date: Thu, 24 Sep 2020 09:24:54 -0400 Subject: [PATCH] Some fixed up commentary on the language in README --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6339588..4834be6 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Tabloid supports binary infix operators for arithmetic and logic. `IS ACTUALLY` is a way to test equality, like `==` in most other languages. We can also make comparisons with `X BEATS Y` (`x > y`) and `X SMALLER THAN Y` (`x < y`). -We can print the result of any expression with `YOU WON'T WANT TO MISS` +We can print the result of any expression with `YOU WON'T WANT TO MISS`. You won't want to miss what you're printing, and now you never will! ``` YOU WON'T WANT TO MISS 'Hello, World!' @@ -70,7 +70,11 @@ WHAT IF condition RUMOR HAS IT END OF STORY ``` -The entire interpreter is contained in a single file, `static/js/lang.js`, and pretty straightforward. Due to the, *ahem*, unusual syntax of Tabloid, there are four layers, which includes a double-pass tokenizer. +In Tabloid, newlines are not significant. If you want, you can squeeze your entire damn program in a single line of source code! How wonderful! I see exactly zero ways that could possibly go wrong. + +The entire interpreter is contained in a single file, `static/js/lang.js`, and pretty straightforward. Due to the, *ahem*, unusual syntax of Tabloid, there are four layers, which includes a double-pass tokenizer that first produces a stream of word tokens (a string literal is a single word, punctuations are treated separately), and then a second tokenizer that tokenizes multi-word keywords like `DISCOVER HOW TO` (which is 3 words). + +The interpreter uses a tree-walk evaluator on the syntax tree to execute a program. ## How to use @@ -81,6 +85,7 @@ Please don't. Tabloid's syntax has some (soft) limitations for now, because I had ~8 hours to finish it. Here are some of them: - The parser doesn't know about operator precedence. To chain infix operators together like `3 PLUS 2 TIMES 10`, use parentheses, like `3 PLUS (2 TIMES 10)`. +- There isn't a built-in looping construct, like a `while` loop. This could be viewed as a feature, but is a little annoying. I left it out because it was less trivial than the other features to implement. - There isn't very good error reporting. If there is an error during parsing or at runtime, the interpreter will currently report an error and what went wrong, but won't tell you where it messed up and will reveal interpreter implementation details. Tabloid also doesn't have comments, because... I honestly forgot about them when I made this and only remembered like 7 hours in, and I got lazy. If this bothers you for some insane reason, feel free to make a pull request... I guess.