Path: csiph.com!xmission!news.snarked.org!border2.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: Sat, 9 Mar 2019 01:47:38 -0500 (EST) Organization: Compilers Central Lines: 37 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <19-03-002@comp.compilers> References: <19-02-002@comp.compilers> <19-02-004@comp.compilers> <19-02-006@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="8155"; mail-complaints-to="abuse@iecc.com" Keywords: lex, design Posted-Date: 09 Mar 2019 01:47:38 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <19-02-006@comp.compilers> Xref: csiph.com comp.compilers:2168 On 2019-02-12 15:43:46 UTC+1 Bart wrote: > 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. Agree. Pattern matching might help a little during tokenising, but I have doubts that it leads to a fast tokenizing function. For parsing I don't think that pattern matching leads to correct results in all cases. I have seen too much buggy attempts to do parsing with pattern matching. Even for such simple things as lines with key=value I saw "solutions" with pattern matching, that triggered bugs when the line was not simple. A good approach for parsing is LL(1), which has nothing to do with pattern matching. With pattern matching you are in danger, to get something that just works when the weather is good. Good compilers just don't use pattern matching for parsing. 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.