Re: syntax complexity

Thomas Koenig <tkoenig@netcologne.de>
Thu, 16 Feb 2023 06:32:50 -0000 (UTC)

          From comp.compilers

Related articles
syntax complexity gah4@u.washington.edu (gah4) (2023-02-15)
Re: syntax complexity tkoenig@netcologne.de (Thomas Koenig) (2023-02-16)
Re: syntax complexity DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2023-02-16)
Re: syntax complexity gah4@u.washington.edu (gah4) (2023-02-16)
Re: syntax complexity gah4@u.washington.edu (gah4) (2023-02-16)
Re: syntax complexity costello@mitre.org (Roger L Costello) (2023-02-20)
Re: syntax complexity gah4@u.washington.edu (gah4) (2023-02-20)
Re: syntax complexity gneuner2@comcast.net (George Neuner) (2023-02-20)
[4 later articles]
| List of all articles for this month |

From: Thomas Koenig <tkoenig@netcologne.de>
Newsgroups: comp.compilers
Date: Thu, 16 Feb 2023 06:32:50 -0000 (UTC)
Organization: news.netcologne.de
References: 23-02-045
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="49480"; mail-complaints-to="abuse@iecc.com"
Keywords: syntax
Posted-Date: 16 Feb 2023 12:57:16 EST

gah4 <gah4@u.washington.edu> 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
226682
$ cat c/*.cc c/*.h | wc -l
60548
$ cat d/*.cc | wc -l
24850
$ cat ada/*.adb ada/*.ads ada/*.c ada/*.h | wc -l
731635


(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.