Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2183

Re: Best language for implementing compilers?

Path csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From mertesthomas@gmail.com
Newsgroups comp.compilers
Subject Re: Best language for implementing compilers?
Date Tue, 12 Mar 2019 10:40:02 -0700 (PDT)
Organization Compilers Central
Lines 52
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <19-03-017@comp.compilers> (permalink)
References <19-02-002@comp.compilers>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Injection-Info gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="57346"; mail-complaints-to="abuse@iecc.com"
Keywords design, practice
Posted-Date 12 Mar 2019 21:12:54 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:2183

Show key headers only | View raw


Am Freitag, 8. Februar 2019 16:55:48 UTC+1 schrieb Costello, Roger L.:
> Best language for implementing compilers?

There are language features, which make programming easier.
This is independent of the type of program.

Compilers are big programs. Compilation speed and/or run-time
performance of the generated program can be a goal. But also the
effort (time) to write a compiler must be taken into account.  The
cost to maintain a compiler is also an important factor.  Therefore
the decision for a compiler language is not so easy.

I have written scanners and parsers in C, C++, Java and Seed7.  I have
used C for the scanner and parser of the Seed7 interpreter.  I have
also written scanner, parser and preprocessor for C in Seed7.  The
code generator of the Seed7 compiler is written in Seed7.  My Basic
interpreter, which tokenizes Basic lines, is written is Seed7.

So I have some experience in writing compiler parts in higher (Seed7)
and lower (C) level languages.

Higher level features like memory management help a lot. E.g.: The
Seed7 compiler generates C code. All this C code snippets are held in
strings. The are concatenated and assigned several times, before they
are written out. Doing this in C with manual memory management would
have been a hard task.

So if you want to create a compiler in a reasonable time I suggest you
prefer a higher level language.

If compilation speed is the criteria number one you will probably need
to use C (to squeze every cycle out of the machine). This is what I
did, when implementing the front end of the Seed7 interpreter.

I designed some language features of Seed7, to support scanning and
parsing. E.g.: Every file in Seed7 has a bufferChar. A bufferChar is
just a single character attached to the file.  If you use LL(1)
parsing for tokens you read a character and assign it to the
bufferChar. Then, depending on the bufferChar, you decide what to do
next. If the bufferChar is a digit you will read a number. If the
bufferChar is a letter you will read an identifier. Etc. Examples of
such scanner functions can be found in the library scanfile.s7i.

Regards,
Thomas Mertes

--
Seed7 Homepage:  http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.

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


Thread

Best language for implementing compilers? "Costello, Roger L." <costello@mitre.org> - 2019-02-08 12:20 +0000
  Re: Best language for implementing compilers? Nala Ginrut <nalaginrut@gmail.com> - 2019-02-09 00:27 +0800
  Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-02-08 18:36 -0500
    Re: Best language for implementing compilers? Bart <bc@freeuk.com> - 2019-02-11 12:59 +0000
      Re: Best language for implementing compilers? drb@ihatespam.msu.edu (Dennis Boone) - 2019-02-12 09:38 -0600
        Re: Best language for implementing compilers? drb@ihatespam.msu.edu (Dennis Boone) - 2019-02-19 11:22 -0500
          Re: Best language for implementing compilers? arnold@skeeve.com (Aharon Robbins) - 2019-02-20 11:48 +0000
      Re: Best language for implementing compilers? Kaz Kylheku <157-073-9834@kylheku.com> - 2019-02-12 16:45 +0000
      Re: Best language for implementing compilers? mertesthomas@gmail.com - 2019-03-09 01:47 -0500
        Re: Best language for implementing compilers? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-03-09 10:14 +0100
          Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-03-09 22:47 -0500
          Re: Best language for implementing compilers? Kaz Kylheku <157-073-9834@kylheku.com> - 2019-03-10 05:40 +0000
        Re: Best language for implementing compilers? Bart <bc@freeuk.com> - 2019-03-09 12:34 +0000
        Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-03-09 22:57 -0500
          Re: Best language for implementing compilers? Kaz Kylheku <157-073-9834@kylheku.com> - 2019-03-10 05:48 +0000
      Re: Best language for implementing compilers? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2019-03-10 04:13 -0700
        Re: Best language for implementing compilers? Bart <bc@freeuk.com> - 2019-03-10 15:33 +0000
          Re: Best language for implementing compilers? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2019-03-11 10:49 -0700
            Re: Best language for implementing compilers? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-03-12 06:54 +0100
              Re: Best language for implementing compilers? Bart <bc@freeuk.com> - 2019-03-13 01:50 +0000
        Re: Best language for implementing compilers? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-03-10 16:13 +0100
          Re: Best language for implementing compilers? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2019-03-11 10:06 -0700
        Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-03-10 18:23 -0400
        Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-03-10 18:58 -0400
  Re: Best language for implementing compilers? "Robin Vowels" <robin51@dodo.com.au> - 2019-02-09 19:58 +1100
  Best language for implementing compilers? David Lovemore <davidlovemore@gmail.com> - 2019-02-12 03:28 -0800
  Re: Best language for implementing compilers? mertesthomas@gmail.com - 2019-03-12 10:40 -0700

csiph-web