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