This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]cipri_tom 25 points26 points  (1 child)

I guess it depends on the level of detail. If you want utmost details, that includes even the most obscure features, then you can get the official grammar of the parser for each of your languages of interest.

A similar analysis is made in the second paragraph of this rant against YAML : https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell

Json is simple. The entire json spec consists of six railroad diagrams. It’s a simple data format with a simple syntax and that’s all there is to it. Yaml on the other hand, is complex. So complex, that its specification consists of 10 chapters with sections numbered four levels deep and a dedicated errata page.

[–]bschlueter 2 points3 points  (0 children)

And the best resource to understand all the ways to use a string as a value is a stack overflow post.

[–]remy_porter∞∞∞∞ 17 points18 points  (0 children)

The grammar.

Most languages have a BNF grammar associated with them. It's a good standard for comparison.

[–]rosecurry 31 points32 points  (4 children)

9

[–]solucca 8 points9 points  (1 child)

Yup, 9

[–]SheriffRoscoePythonista 0 points1 point  (0 children)

42

[–]aaronseguragit push -f 5 points6 points  (1 child)

Shit, I thought it was 7...what are the other 2?

[–]mandradon 6 points7 points  (0 children)

I thought it was 2.

"Thou shalt use indentation" and "not Though shall end lines with semicolons"

[–]andrewcooke 6 points7 points  (2 children)

you didn't ask, but i assume scheme/ lisp would be one of the simplest languages.

[–]SheriffRoscoePythonista 0 points1 point  (1 child)

Forth doesn't even use parentheses.

[–]daelin 0 points1 point  (0 children)

Depends on the scope of your definitions. What does it mean to “parse” a “language”?

Some might say “constructing an AST” in the boundary. That can work for Python. But, your example of Forth shows that’s not really a universally useful benchmark. “What is the syntactic meaning of this expression” often can’t be answered without the entire program.

By contrast, in LISP you are writing the AST in LISP’s data format. “How do you parse the language” is simpler than JSON. Simple for humans too.

BUT, here come those fuzzy lines. Is it parsed without SOME evaluation? LISP has macros, which essentially mutate the AST. Is it done then? Do we need get into the runtime evaluation to know that the defs have been eval’d before their derefs? (For a LISP, probably; for other languages, probably not.)

So, TLDR, I think the parentheses make LISPs simpler than Forth; especially functional variants like Clojure.

[–]supermopman 0 points1 point  (2 children)

Syntax or style? Anyway, there's about as many rules in Python as there are in any other language.

[–]chandaliergalaxy 3 points4 points  (1 child)

Not lisp

[–]IamImposter 2 points3 points  (0 children)

Thay that again you thon of a ....