Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: gah4 Newsgroups: comp.compilers Subject: Re: What attributes of a programming language simplify its implementation? Date: Sat, 1 Oct 2022 17:05:56 -0700 (PDT) Organization: Compilers Central Lines: 52 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-10-004@comp.compilers> References: <22-09-026@comp.compilers> <22-10-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="14637"; mail-complaints-to="abuse@iecc.com" Keywords: design, comment Posted-Date: 01 Oct 2022 21:34:55 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <22-10-002@comp.compilers> Xref: csiph.com comp.compilers:3181 On Saturday, October 1, 2022 at 12:28:25 PM UTC-7, Martin Ward wrote: (snip) It seems to me that there are two questions, more or less syntax and semantics. Mattbe what the language allows you to ask, and what happens when you do it. I have always found Fortran had strange restrictions on what you were allowed to do. Some because it made the compiler easier to write (especially in the early days), but also because someone thought you shouldn't do that. REAL DO variables were added in Fortran 77, and then removed not so much later. On the other hand, PL/I is pretty good at allowing things, even if there isn't much reason. I did this one in high school, not knowing if it would actually work: DCL (I, J, K, L) CHAR(100); J='1'; K='100'; L='1'; DO I=J TO K BY L; PUT LIST(I, SQRT(I)); END; I suspect no designers of PL/I ever expected someone to try it, but the ability is there, and compilers do it. Now, it turns out that you have to add a few blanks to K, as the loop comparison is done as a string compare. (I didn't guess that until finding that the loop didn't end.) C lets you do some things that it probably shouldn't, though. Unlike many languages, the whole definition of PL/I was written before writing the first compiler. (Not that all features were implemented in the first compiler.) [PL/I was a remarkably good language considering what a rush job it was but it has plenty of odd things, e.g. DCL (I, J, K) CHAR(3); I = 1; J = 2; K = I+J; What does K contain? Nope, it contains three spaces because the 1 and 2 are converted to ' 1' and ' 2', they're converted back to integer, added, converted back to to a default size integer string like ' 3' and string assignment truncates from the right. -John]