Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Christopher F Clark Newsgroups: comp.compilers Subject: Re: Wrestling with phase 1 of a C compiler Date: Tue, 13 Sep 2022 14:55:18 +0300 Organization: Compilers Central Lines: 45 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-09-006@comp.compilers> References: <22-09-001@comp.compilers> <22-09-004@comp.compilers> <22-09-005@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="31319"; mail-complaints-to="abuse@iecc.com" Keywords: parse, history, macros Posted-Date: 14 Sep 2022 16:25:35 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:3158 I never used the PL/I preprocessor myself. However, at my first job (at SofTech), my mentor (Carl Martin) made some PL/I macros that *loosely* translated a subset of Jovial into Multics PL/I. It was still PL/I semantics, but Jovial syntax. That allowed us to write our Jovial compilers in that subset of Jovial and get it working before it could become self-hosting. But notice that these were mostly minor syntactic changes and no error checking, no semantic changes, etc. It was only used for one project and one team and two compilers (one targeting Multics and the other targeting the Interdata 8/32). So, the fact that it wasn't very robust wasn't an issue. This is very different than trying to make a functional library in an imperative language. ---------- On a related note, I have heard stories from C++ compiler implementors about the various template libraries that have been created which attempt to do "Turing machine" style (NP-complete) computations via types and parameters, where the users wonder why the compilation process takes much longer than running the resultant program. This is the kind of mess one makes when one sees a hammer and treats screws as nails. Yes, with enough force you can pound a screw into wood (or a wall) but the result is NOT a good fastener. Screws are threaded for a reason and nails are not for the complementary reason. Different semantics. I rarely create my own C++ templates nor Rust macros for that reason. It is too easy to create things that look clever but are essentially undecipherable. As the saying goes: "With great power comes great responsibility." Kind regards, Chris -- ****************************************************************************** Chris Clark email: christopher.f.clark@compiler-resources.com Compiler Resources, Inc. Web Site: http://world.std.com/~compres 23 Bailey Rd voice: (508) 435-5016 Berlin, MA 01503 USA twitter: @intel_chris ------------------------------------------------------------------------------