Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #61154

Re: Information on compiler/parser techniques for a new C-derived programming language

From Morris Dovey <mrdovey@iedu.com>
Newsgroups comp.lang.c
Subject Re: Information on compiler/parser techniques for a new C-derived programming language
Date 2015-04-26 13:49 -0500
Organization http://www.iedu.com/Solar/
Message-ID <mhjbvi$4oj$1@speranza.aioe.org> (permalink)
References (4 earlier) <31167adc-0da9-408f-9232-95a8f769895f@googlegroups.com> <mgqujf$q3n$1@speranza.aioe.org> <3b9fac2f-94df-4bdc-b9cc-880a9218cdf1@googlegroups.com> <mgrdvh$2lg$1@speranza.aioe.org> <bfb4ffab-9c7e-4064-94d1-8a06cd9a13d0@googlegroups.com>

Show all headers | View raw


On 4/26/15 12:40 PM, fir wrote:
> W dniu piątek, 17 kwietnia 2015 18:56:28 UTC+2 użytkownik Morris
> Dovey napisał:
>> On 4/17/15 8:02 AM, fir wrote:
>>
>>> but something must compile this.. this looks like only
>>> description of the translation flow, not the algorithms to
>>> translate the source file according to those rules..
>>
>> Yes, of course. There are three steps...
>>
>> [1] I have an executable named PLC3.COM that reads PLC3.PLC and
>> outputs an assembly language file named PLC3.MAC
>>
>> [2] PLC3.MAC is read by the assembler to produce PLC3.OBJ and
>> PLC3.PRN (a listing file)
>>
>> [3] PLC3.OBJ and PLCLIB.OBJ are read by the linker to produce
>> (amazingly!) an executable program named PLC3.COM - an exact
>> duplicate of the program used in the first step.
>>
>> To make a different compiler, you need only perform this same
>> sequence with the source file for your new compiler, it's not very
>> complicated.
>>
>> I uploaded a copy of PLC3.PRN so you can see PLC3.MAC and what the
>>  assembler makes of it. See http://www.iedu.com/tmp/PLC3.PRN
>>
> It is hardly unbelivable, i am not understanding something or yopu
> are skipping something

The only part you haven't seen are the functions called by the compiler.
There are between one and two dozen of them, and none are very large.
They are, however somewhat visible in the form of CALLs in both compiler
output specifications and in the generated assembly code.

> this plc code has 9probably) no algorithm, routines, it seem only
> like rules to interpret

Correct. This is not a general purpose programming language but, rather,
a language intended to deal only with translation of an input stream
with a specified syntax to an output stream according to the rules the
programmer specifies.

> to make a compiler you must to code algorithm/procedure

Yes/no/maybe. :-) If you choose, you may find it easier to think of this
language in a way that defines each statement as a procedure, with each
element of each statement producing a call to a sub-procedure.

> com is taking plc outputing mac thats okay stap it may be doing this

Thank you, that's exactly how it works. It did take some time and effort
on my part to make that happen. :-)

> asembletr and linker is makimg  com from mac it is also okay,

Yes - but I can't take credit for that part.

> but it is hard to belive that this plc describes whole mechanic of
> "reading this plc and transforming it to mac" that describes this
> whole progrem of reading that and transforming it to mac (there
> musyt be come component that is hidden and is not in plc source )

Believe it. You've seen everything except the library (written in
assembly code).

> if so (and this is a whole compiler of itself) how it is doing that?
> i damn doesnt understand this

Well, it's not magic. I started with Bakus-Naur notation for syntax and
observed that it /could/ be a programming language for producing
parsers, and from there I hypothesized that with the addition of an
output capability, it could also produce full-bore interpreters and
translators.

> ps
>
> for example is such compiler of such source of itself
>
> "compile this compiler"

Yes, plc3.plc is the source for the compiler hand-written in its own
source language. Version 3 was the first to have all the language
features I felt were needed to produce future variants.

> possible? im bit confuzed maybe but i think NO compiler needs a code
> to read its source then output what it needs etc 9and here if it
> works the source is somewhere behind this line)

It's not altogether easy to grasp, but neither is it impossible. If
you're interested, I just uploaded a stripped-down (to show only a
simplified syntax) version of the source. With the housekeeping and
output code out of the way, you'll see a much stronger resemblance to
the Bakus-Naur format I started with. See
http://www.iedu.com/tmp/PLC-Syntax.PLC

-- 
Morris Dovey
http://www.iedu.com/Solar

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-16 13:26 -0700
  Re: Information on compiler/parser techniques for a new C-derived programming language Bartc <bc@freeuk.com> - 2015-04-16 23:02 +0100
    Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-17 12:40 -0700
      Re: Information on compiler/parser techniques for a new C-derived programming language James Kuyper <jameskuyper@verizon.net> - 2015-04-17 16:36 -0400
        Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-18 11:04 -0700
          Re: Information on compiler/parser techniques for a new C-derived programming language James Kuyper <jameskuyper@verizon.net> - 2015-04-18 22:53 -0400
            Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-22 13:07 -0700
          Re: Information on compiler/parser techniques for a new C-derived programming language Robert Wessel <robertwessel2@yahoo.com> - 2015-04-18 23:14 -0500
      Re: Information on compiler/parser techniques for a new C-derived programming language Bartc <bc@freeuk.com> - 2015-04-18 14:34 +0100
  Re: Information on compiler/parser techniques for a new C-derived programming language Richard Damon <Richard@Damon-Family.org> - 2015-04-16 20:59 -0400
    Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-17 13:33 -0700
      Re: Information on compiler/parser techniques for a new C-derived programming language James Kuyper <jameskuyper@verizon.net> - 2015-04-17 16:59 -0400
  Re: Information on compiler/parser techniques for a new C-derived programming language Robert Wessel <robertwessel2@yahoo.com> - 2015-04-16 23:02 -0500
    Re: Information on compiler/parser techniques for a new C-derived programming language David Brown <david.brown@hesbynett.no> - 2015-04-17 10:55 +0200
      Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-18 11:48 -0700
        Re: Information on compiler/parser techniques for a new C-derived programming language David Brown <david.brown@hesbynett.no> - 2015-04-18 21:55 +0200
          Re: Information on compiler/parser techniques for a new C-derived programming language Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-04-19 11:39 +0000
            Re: Information on compiler/parser techniques for a new C-derived programming language Bartc <bc@freeuk.com> - 2015-04-19 12:48 +0100
              Re: Information on compiler/parser techniques for a new C-derived programming language Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-04-19 14:07 +0000
            Re: Information on compiler/parser techniques for a new C-derived programming language David Brown <david.brown@hesbynett.no> - 2015-04-19 23:26 +0200
        Re: Information on compiler/parser techniques for a new C-derived programming language Bartc <bc@freeuk.com> - 2015-04-19 12:28 +0100
    Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-17 14:41 -0700
      Re: Information on compiler/parser techniques for a new C-derived programming language Robert Wessel <robertwessel2@yahoo.com> - 2015-04-17 18:41 -0500
        Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-18 11:30 -0700
      Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-18 03:37 -0700
        Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-18 03:44 -0700
          Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-18 03:59 -0700
  Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-17 02:38 -0700
    Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-17 02:54 -0700
    Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-18 12:43 -0700
      Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-18 13:56 -0700
      Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-19 00:43 -0700
        Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-19 01:18 -0700
          Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-22 13:39 -0700
            Re: Information on compiler/parser techniques for a new C-derived programming language Bartc <bc@freeuk.com> - 2015-04-22 22:28 +0100
              Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-28 13:28 -0700
                Re: Information on compiler/parser techniques for a new C-derived programming language Bartc <bc@freeuk.com> - 2015-04-28 21:55 +0100
            Re: Information on compiler/parser techniques for a new C-derived programming language Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-22 23:21 +0100
            Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-24 00:27 -0700
        Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-26 01:09 -0700
          Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-26 11:29 -0700
  Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-17 03:16 -0700
    Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-17 03:38 -0700
      Re: Information on compiler/parser techniques for a new C-derived programming language Morris Dovey <mrdovey@iedu.com> - 2015-04-17 06:32 -0500
        Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-17 05:11 -0700
          Re: Information on compiler/parser techniques for a new C-derived programming language Morris Dovey <mrdovey@iedu.com> - 2015-04-17 07:33 -0500
            Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-17 06:02 -0700
              Re: Information on compiler/parser techniques for a new C-derived programming language Morris Dovey <mrdovey@iedu.com> - 2015-04-17 11:56 -0500
                Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-17 16:15 -0700
                Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-26 10:40 -0700
                Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-26 10:47 -0700
                Re: Information on compiler/parser techniques for a new C-derived programming language Morris Dovey <mrdovey@iedu.com> - 2015-04-26 13:49 -0500
  Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-17 11:17 -0700
  Re: Information on compiler/parser techniques for a new C-derived programming language Melzzzzz <mel@zzzzz.com> - 2015-04-18 05:34 +0200
  Re: Information on compiler/parser techniques for a new C-derived programming language luser droog <luser.droog@gmail.com> - 2015-04-17 23:18 -0700
    Re: Information on compiler/parser techniques for a new C-derived programming language Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-20 09:39 -0700
      Re: Information on compiler/parser techniques for a new C-derived programming language luser droog <luser.droog@gmail.com> - 2015-04-20 23:11 -0700
        Re: Information on compiler/parser techniques for a new C-derived programming language luser droog <luser.droog@gmail.com> - 2015-04-25 21:41 -0700
  Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-18 04:59 -0700
    Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-18 05:16 -0700
    Re: Information on compiler/parser techniques for a new C-derived programming language fir <profesor.fir@gmail.com> - 2015-04-18 05:43 -0700

csiph-web