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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3ef3e78eacf6f938 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news2.google.com!goblin3!goblin2!goblin.stu.neva.ru!aioe.org!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Date: Tue, 23 Mar 2010 22:08:39 -0400 Organization: The Wasteland Message-ID: References: <7a0c7a19-5d83-4cc6-be68-95ebf41533e7@t23g2000yqt.googlegroups.com> <3b3f991b-8fcd-435c-83f6-e1a1a5e8f6ed@a31g2000prd.googlegroups.com> NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news1.google.com comp.lang.ada:9717 Date: 2010-03-23T22:08:39-04:00 List-Id: In article <3b3f991b-8fcd-435c-83f6-e1a1a5e8f6ed@a31g2000prd.googlegroups.com>, Adam Beneschan wrote: > On Mar 23, 1:27 pm, "John B. Matthews" wrote: > > In article > > <7a0c7a19-5d83-4cc6-be68-95ebf4153...@t23g2000yqt.googlegroups.com>, > > > >  cbcurl wrote: > > > since when was Pascal ever an interpreted language > > > > AFAIK, ca. 1977, . > > I wouldn't call it an interpreted language, really. The UCSD > compiler generated code for a machine that didn't exist, and then > programs ran by interpreting that machine's instructions. However, > my recollection is that the pseudo-machine's instruction set really > didn't have anything to do with Pascal and could have been used for > any language. A few years later, Western Digital developed a machine > that executed the P-machine's instructions directly (in microcode). > The lab I worked for back in college (at UC Irvine) used this > compiler, and we had one of the WD machines also, so this is > something I'm quite familiar with, as far as the deteriorating brain > cells of my memory permit. > > This doesn't meet my criteria for what I'd call an interpreted > language. For that, I'd assume that the interpreter reads the > original source statements, or some sort of tokenized form that bears > a close relation to the original source statements, while running the > program. I'd also assume that variables and other identifiers are > stored by name, or by something equivalent such as a pointer into a > string table, but that in any case the interpreter does things "by > name". In contrast, I believe that UCSD Pascal allocated local stack > variables pretty much the same way a native compiler would, > referencing them via byte or word offsets from the top or bottom of a > stack frame, although it's been a really long time so I could be > wrong here. No, I believe you are correct, and you draw a useful distinction. Basic interpreters of that era stored tokenized keywords, but the variable names--at least the first few characters--were legible in the stored program. In contrast, the compiled p-code was quite generic; I briefly used a Fortran compiler that generated p-code, and I'm sure others were available. The p-code itself was interpreted. I still enjoy using the system in emulation. As a concrete example, ]list 10 A% = 12345: PRINT A% ]mtr *800.81f 00/0800:00 12 08 0A 00 41 25 D0-.....A%P 00/0808:31 32 33 34 35 3A BA 41-12345::A 00/0810:25 00 00 00 64 C1 80 30-%...dA.0 00/0818:39 00 00 00 24 D0 E7 28-9...$Pg( In Basic, the variable name "A" appears in both the tokenized source and the variable table; its value appears as a string literal and a twos-complement integer: 16#3039#. $ ac -e Pascal.2mg test.text {$R-} program Test; var a: Integer; begin a := 12345; Writeln(a); end. $ ac -e Pascal.2mg temp.text Code file = test.code The following library bytes are non-zero: TEST is a linked segment (P-code vers.6), length = 42 bytes ** # PROCS = 1, SEGMENT # = 1 Disassembly for procedure # 1; Lex level = 0 P-code procedure 1 Code = 27, parameters = 4, data = 2 bytes; Jump table = 0 words 0: D7 NOP 1: D7 NOP 2: C7 39 30 LDCI 12345 5: AB 03 SRO 3 7: B6 01 03 LOD 1,3 10: EA SLDO 3 11: 00 SLDC 0 12: CD 00 0D CXP 0,13 15: 9E 00 CSP 0 17: B6 01 03 LOD 1,3 20: CD 00 16 CXP 0,22 23: 9E 00 CSP 0 25: C1 00 RBP 0 Even without elaborating on the opcodes, it's clear that constant remains while variable and procedure names have been elided. When I encountered Java bytecode decades later, everything old was new again. -- John B. Matthews trashgod at gmail dot com