Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.compilers > #3386

Re: syntax complexity

From Thomas Koenig <tkoenig@netcologne.de>
Newsgroups comp.compilers
Subject Re: syntax complexity
Date 2023-02-16 06:32 +0000
Organization news.netcologne.de
Message-ID <23-02-046@comp.compilers> (permalink)
References <23-02-045@comp.compilers>

Show all headers | View raw


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

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

syntax complexity gah4 <gah4@u.washington.edu> - 2023-02-15 15:08 -0800
  Re: syntax complexity Thomas Koenig <tkoenig@netcologne.de> - 2023-02-16 06:32 +0000
  Re: syntax complexity Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2023-02-16 12:03 +0100
    Re: syntax complexity gah4 <gah4@u.washington.edu> - 2023-02-16 11:33 -0800
      Re: syntax complexity gah4 <gah4@u.washington.edu> - 2023-02-16 16:08 -0800
      Re: syntax complexity Roger L Costello <costello@mitre.org> - 2023-02-20 15:09 +0000
        Re: syntax complexity gah4 <gah4@u.washington.edu> - 2023-02-20 09:57 -0800
          Re: syntax complexity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2023-02-21 08:14 +0000
            Re: syntax complexity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2023-02-21 18:39 +0000
              Re: ireegular expressions, syntax complexity anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2023-02-22 10:55 +0000
            Re: irregular expressions, syntax complexity arnold@freefriends.org (Aharon Robbins) - 2023-02-22 08:53 +0000
            Re: irregular expressions, syntax complexity Kaz Kylheku <864-117-4973@kylheku.com> - 2023-02-23 00:34 +0000
        Re: syntax complexity George Neuner <gneuner2@comcast.net> - 2023-02-20 13:49 -0500
      syntax complexity Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2023-02-21 20:54 +0200

csiph-web