Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1730
| From | rockbrentwood@gmail.com |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: New experimental back end for C/C++ compiler targeting CLI |
| Date | 2016-08-26 12:54 -0700 |
| Organization | Compilers Central |
| Message-ID | <16-08-008@comp.compilers> (permalink) |
| References | <16-08-007@comp.compilers> |
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.
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
New experimental back end for C/C++ compiler targeting CLI Alexandre <alebencz@gmail.com> - 2016-08-25 10:40 -0300
Re: New experimental back end for C/C++ compiler targeting CLI rockbrentwood@gmail.com - 2016-08-26 12:54 -0700
Re: New experimental back end for C/C++ compiler targeting CLI Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2016-08-29 10:28 +0200
Re: New experimental back end for C/C++ compiler targeting CLI BartC <bc@freeuk.com> - 2016-08-29 18:52 +0100
Re: New experimental back end for C/C++ compiler targeting CLI Walter Banks <walter@bytecraft.com> - 2016-08-29 21:21 -0400
Re: New experimental back end for C/C++ compiler targeting CLI Walter Banks <walter@bytecraft.com> - 2016-08-30 13:44 -0400
Re: New experimental back end for C/C++ compiler targeting CLI BartC <bc@freeuk.com> - 2016-08-30 22:48 +0100
Re: New experimental back end for C/C++ compiler targeting CLI Walter Banks <walter@bytecraft.com> - 2016-08-31 13:24 -0400
Re: New experimental back end for C/C++ compiler targeting CLI Martin Ward <martin@gkc.org.uk> - 2016-09-06 18:09 +0100
Re: New experimental back end for C/C++ compiler targeting CLI Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2016-08-30 13:13 +0200
Re: New experimental back end for C/C++ compiler targeting CLI Walter Banks <walter@bytecraft.com> - 2016-08-29 13:15 -0400
csiph-web