Commit af771595 authored by Nicolas Lenz's avatar Nicolas Lenz
Browse files

Fixes

parent 3a8b08cc
Pipeline #848 passed with stage
in 8 seconds
......@@ -10,9 +10,9 @@ This question is important because depending on your answer, there are a few spe
### Easy to Parse **vs.** Easy to Read
It should be easy to write parsers for machine language. The syntax should therefore be very explicit and the grammar simple without syntactic sugar. A good example is [JSON](): There are booleans, numbers, strings, lists and dicts, each with a clearly distinguishably syntax without exceptions. That's it. I can write a parser for it in very little time. Another example is [Scheme]() or [Lisp](): Its exhaustive bracketing makes it easy to parse^[Take a look at [Write Yourself a Scheme in 48 Hours](https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours)!] as there is, among other things, no operator precedence to consider, but it makes it harder to read.
It should be easy to write parsers for machine language. The syntax should therefore be very explicit and the grammar simple without syntactic sugar. A good example is [JSON](): There are booleans, numbers, strings, lists and dicts, each with a clearly distinguishably syntax without exceptions. That's it. I can write a parser for it in very little time. Another example is [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language)) or [Lisp](https://en.wikipedia.org/wiki/Lisp_(programming_language)): Its exhaustive bracketing makes it easy to parse[^scheme] as there is, among other things, no operator precedence to consider, but it makes it harder to read.
However, a language that is easy to parse through a machine is not necessarily easy to read for a human. JSON is easy to parse, but [YAML](https://yaml.org/)^[Note that YAML is *not* a good language. It has a [lot of problems](https://github.com/cblp/yaml-sucks), but in its basic form it's easy to read. Take a look at [strictyaml](https://hitchdev.com/strictyaml/) if you want something better.] is easier to read, as it has pretty syntactic sugar (e.g. you can often leave out the quotes), less syntactic noise and enforces using line breaks. Things that make it harder to parse, but easier to read.
However, a language that is easy to parse through a machine is not necessarily easy to read for a human. JSON is easy to parse, but [YAML](https://yaml.org/)[^yaml] is easier to read, as it has pretty syntactic sugar (e.g. you can often leave out the quotes), less syntactic noise and enforces using line breaks. Things that make it harder to parse, but easier to read.
### Easy to Generate **vs.** Easy to Write
......@@ -25,3 +25,6 @@ A machine-focused language should be simple and low-level. The obvious example w
## Conclusion
Know who your language's target audience is and design it with them in mind.
[^scheme]: Take a look at [Write Yourself a Scheme in 48 Hours](https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours)!
[^yaml]: Note that YAML is *not* a good language. It has a [lot of problems](https://github.com/cblp/yaml-sucks), but in its basic form it's at least easy to read. Take a look at [strictyaml](https://hitchdev.com/strictyaml/) if you want something better.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment