Re: New experimental back end for C/C++ compiler targeting CLI

rockbrentwood@gmail.com
Fri, 26 Aug 2016 12:54:34 -0700 (PDT)

          From comp.compilers

Related articles
New experimental back end for C/C++ compiler targeting CLI alebencz@gmail.com (Alexandre) (2016-08-25)
Re: New experimental back end for C/C++ compiler targeting CLI rockbrentwood@gmail.com (2016-08-26)
Re: New experimental back end for C/C++ compiler targeting CLI DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2016-08-29)
Re: New experimental back end for C/C++ compiler targeting CLI walter@bytecraft.com (Walter Banks) (2016-08-29)
Re: New experimental back end for C/C++ compiler targeting CLI bc@freeuk.com (BartC) (2016-08-29)
Re: New experimental back end for C/C++ compiler targeting CLI walter@bytecraft.com (Walter Banks) (2016-08-29)
Re: New experimental back end for C/C++ compiler targeting CLI DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2016-08-30)
Re: New experimental back end for C/C++ compiler targeting CLI walter@bytecraft.com (Walter Banks) (2016-08-30)
[3 later articles]
| List of all articles for this month |
From: rockbrentwood@gmail.com
Newsgroups: comp.compilers
Date: Fri, 26 Aug 2016 12:54:34 -0700 (PDT)
Organization: Compilers Central
References: 16-08-007
Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="85269"; mail-complaints-to="abuse@iecc.com"
Keywords: C, code
Posted-Date: 28 Aug 2016 20:44:08 EDT

On Thursday, August 25, 2016 at 10:17:46 AM UTC-5, Alexandre wrote:
> Btw, at now, is just a experimental project, it's not build every C
> program...


I've been looking seriously, as of late, at doing {machine,source} to source
synthesis -- even "normalization" (source to source synthesis from/to the same
language); the key trick being to combine the so-called abstract syntax tree
and control flow graphs into one by making the abstract syntax tree, itself,
the control flow graph ... i.e. by using an infinitary abstract syntax. That
means that a loop
      while (E) S
gets represented the very same way as the branch
      if (E) { S while (E) S }
in the graph.


This goes perfectly with continuation semantics since it requires a
place-holder Q; so that a statement {if (E) S} is "completed" with Q into
      {if (E) S}[Q] = E? S[Q]: Q
When applied to the loop, the result is a conditional expression with an
infinite abstract syntax
      E? S[E? S[E? S[...]: Q]: Q]: Q.
The abstract syntax "tree", itself, is compactly represented in its "maximally
rolled up" form as a cyclic graph; and that graph is none other than the
control flow graph. So the AST and CFG become one and the same.


Data flow analysis is done by the framework underlying the "magic algebra" I
described here:
https://www.scribd.com/document/235320018/Magic-Algebra-The-Algebraic-Approac
h-to-Control-Flow-Analysis


The REAL trick though -- especially with source-to-source transformation is
converting the white space! About 75-80% of the "indent" utility revolves
around that very issue; and when I do conversions by hand a similar percentage
of effort is involved in dealing with this issue -- particularly in converting
or rewriting the language IN the comments.


A really good source-to-source compiler should also be making proper
adjustments to the comments. That may even entail a degree of natural language
processing! Except for the "may" part.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.