Re: syntax complexity

Thomas Koenig <>
Thu, 16 Feb 2023 06:32:50 -0000 (UTC)

          From comp.compilers

Related articles
syntax complexity (gah4) (2023-02-15)
Re: syntax complexity (Thomas Koenig) (2023-02-16)
Re: syntax complexity (Hans-Peter Diettrich) (2023-02-16)
Re: syntax complexity (gah4) (2023-02-16)
Re: syntax complexity (gah4) (2023-02-16)
Re: syntax complexity (Roger L Costello) (2023-02-20)
Re: syntax complexity (gah4) (2023-02-20)
Re: syntax complexity (George Neuner) (2023-02-20)
[4 later articles]
| List of all articles for this month |

From: Thomas Koenig <>
Newsgroups: comp.compilers
Date: Thu, 16 Feb 2023 06:32:50 -0000 (UTC)
References: 23-02-045
Injection-Info:; posting-host=""; logging-data="49480"; mail-complaints-to=""
Keywords: syntax
Posted-Date: 16 Feb 2023 12:57:16 EST

gah4 <> schrieb:
> I started this in another thread, but I think it deserves its own.
> The question is, how does one measure syntax complexity, with the
> specific case of Fortran vs. PL/I. (And ignoring syntax vs. semantics,
> for now.)

A reasonable zeroth-order approximation is the length of the language
standard (which would also include semantics).

Fortran 2018: 599 pages, without the index.

C++ 2020: 1663 pages, without cross-references and indices.

C (2020 draft): 393 pages without annexes, 572 pages including
the non-normative annexes.

It is probably not fair to compare document sizes of early standards
like the very first programming language standard, Fortran 66.
That was very short at 36 pages, but people were still learning
how to write language standards at the time.

Another very rough measure would be the size of a front end in the
same compiler. Using the even rougher estimate of text lines
for gcc, I get

$ cat fortran/*.cc fortran/*.h | wc -l
$ cat c/*.cc c/*.h | wc -l
$ cat d/*.cc | wc -l
$ cat ada/*.adb ada/*.ads ada/*.c ada/*.h | wc -l

(Right now, I'm not sure how to identify all the files in the C++
front end. Ada may be misrepresented because the compiler is mostly
written in Ada instead of C++, and it is a more verbose language than
C++. The Fortran front end is nominally C++, but due to its history
mostly sticks to the common subset of C and C++. This is text lines,
not statements. I'm not sure if I included the Ada runtime library in
that estimate or not. Like I wrote above, a rough estimate).

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.