From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,d24e07f660698f1 X-Google-Attributes: gid109fba,public X-Google-Thread: fac41,d24e07f660698f1 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,d24e07f660698f1 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,d24e07f660698f1 X-Google-Attributes: gidf43e6,public From: hslama@datacomm.ch (Heribert Slama) Subject: Re: I use Eiffel! and other "strange tongues"! Date: 1997/08/09 Message-ID: <33eb6909.14319826@news.datacomm.ch>#1/1 X-Deja-AN: 263435713 References: <33C61545.167EB0E7@tower.com> <01bc94e6$9ced0820$287b7b7a@tlo2> <33E1B18E.66B4DEC2@docs.uu.se> <33e4d7ec.1596193@news.deltanet.com> <33E61DE1.55E9@pseserv3.fw.hac.com> Newsgroups: comp.software-eng,comp.lang.eiffel,comp.lang.c++,comp.lang.ada Date: 1997-08-09T00:00:00+00:00 List-Id: On 6 Aug 1997 09:03:07 -0400, in comp.software-eng, dewar@merv.cs.nyu.edu (Robert Dewar) wrote: ><<> What I'm saying is, you can write a Prolog interpreter, a >> Smalltalk interpreter, a Fortan Compiler etc etc etc in C! But >> you can't do the reverse. .... >>...... > >Complete nonsense of course, the reverse is perfectly easy to do, ... >...... Harsh words, but you're right. Only, I would've said "can be done" instead of "is perfectly easy to do". >I guess the writer is someone who only knows C, and cannot imagine >that any other language could possibly be interesting (actually C >is NOT a particularly good choice for writing a compiler, the last >full compiler I wrote, not counting GNAT written in Ada 95, weas >written entirely in COBOL, and I found it a much more pleasant >language for compiler writing than C. Oh, if you could've seen my eyes popping out! I even shouted _nonsense_ (or was it #+%%&**# ?). Good, you couldn't hear that. Instead let me ask you 2 questions: 1. what was the language to be compiled? 2. which version of COBOL did you use? I had my latest contact with COBOL about 3 years ago. It was COBOL-II on an IBM mainframe; this version still lacked the following features available in C, PL/I, ALGOL, MODULA-2 (Pascal) and even BASIC: - Internal subroutines with a parameter-passing mechansim, i.e. subroutines defined in the same source module which could be CALLed in the same way as external subroutines. (Well, parameter passing (by value only) can be emulated by moving data to and from work fields. I would hate to write so many lines of code.) - Pointers and storage management to build complex and highly variable data structures. (Well, a big table of characters/integers could emulate a heap and its indexes be used as pointers. Instead of dynamic structures one could often use sufficiently big static ones. I wouldn't take that path.) - No stack ("automatic") variables, therefore no recursive calls, not even indirect ones. Most programming languages contain nested constructs (data definitions, expressions etc.). The use of recursive procedures within the compiler is a quite natural approach. Are there ways around it? Or, can you somehow emulate a recursive call in COBOL? I'm not an expert in this field. But still, I would expect the solution to be tedious for the programmer. All in all, I would never choose COBOL (as_I_know_it) to write a compiler. Maybe your COBOL is much more adavanced than the run-of-the-mill COBOL used on mainframes for commercial applications? Then I would say: Yes, it's an option (and a matter of taste). Bye -Heribert --- Heribert Slama Systems programmer Muttenz, Switzerland