Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Bart Newsgroups: comp.compilers Subject: Re: Best language for implementing compilers? Date: Mon, 11 Feb 2019 12:59:08 +0000 Organization: virginmedia.com Lines: 31 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <19-02-006@comp.compilers> References: <19-02-002@comp.compilers> <19-02-004@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="99615"; mail-complaints-to="abuse@iecc.com" Keywords: code, ML, comment Posted-Date: 12 Feb 2019 09:43:43 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Content-Language: en-GB Xref: csiph.com comp.compilers:2158 On 08/02/2019 23:36, George Neuner wrote: > On Fri, 8 Feb 2019 12:20:18 +0000, "Costello, Roger L." > wrote: > >> What is it about ML that makes it such a good language for implementing >> compilers? > > Compiling involves a lot of pattern matching, and pattern matching is > a native feature of ML. You mean for tokenising and parsing? That would be a small part of compilation (the easy bit, in my view), although it seems to be a preoccupation of this group. But don't people (not me) tend to use external tools for that? I would say that no special language features at all are required for writing a compiler, even if parsing is directly coded in the language. In fact it is one of the least demanding kinds of programs as usually it will take one or more files as input, and write one or more files as output. It doesn't even need flexible strings, as suggested in another post, as most strings once encountered will be a fixed size. (Although first-class string handling is useful if generating another source code as output.) -- bart [If a language doesn't have some sort of data structures, pointers, and dynamic memory allocation, writing a compiler in it will be painful. -John]