Re: Third party compiler middle and back-end

George Neuner <gneuner2@comcast.net>
Mon, 18 Oct 2010 09:14:16 -0400

          From comp.compilers

Related articles
[8 earlier articles]
Re: Third party compiler middle and back-end bobduff@shell01.TheWorld.com (Robert A Duff) (2010-10-13)
Re: Third party compiler middle and back-end cr88192@hotmail.com (BGB / cr88192) (2010-10-13)
Re: Third party compiler middle and back-end cr88192@hotmail.com (BGB / cr88192) (2010-10-13)
Re: Third party compiler middle and back-end FredJScipione@alum.RPI.edu (Fred J. Scipione) (2010-10-13)
Re: Third party compiler middle and back-end danielzazula@gmail.com (Daniel Zazula) (2010-10-17)
Re: Third party compiler middle and back-end gneuner2@comcast.net (George Neuner) (2010-10-17)
Re: Third party compiler middle and back-end gneuner2@comcast.net (George Neuner) (2010-10-18)
Re: Third party compiler middle and back-end cr88192@hotmail.com (BGB / cr88192) (2010-10-18)
Re: Third party compiler middle and back-end redbrain@gcc.gnu.org (Philip Herron) (2010-10-19)
Re: Third party compiler middle and back-end cr88192@hotmail.com (BGB / cr88192) (2010-10-19)
Re: Third party compiler middle and back-end gneuner2@comcast.net (George Neuner) (2010-10-22)
Re: Third party compiler middle and back-end bc@freeuk.com (BartC) (2010-10-22)
Re: Third party compiler middle and back-end bc@freeuk.com (BartC) (2010-10-23)
| List of all articles for this month |
From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: Mon, 18 Oct 2010 09:14:16 -0400
Organization: A noiseless patient Spider
References: 10-10-010 10-10-024 10-10-025
Keywords: C, translator
Posted-Date: 18 Oct 2010 23:31:20 EDT

On Sun, 17 Oct 2010 04:37:12 -0700 (PDT), Daniel Zazula
<danielzazula@gmail.com> wrote:


>Thanks for all the suggestions.
>I didn't say this before but what I really want to do is test a
>concept language, in other words: I don't care how the compiler work
>as long as A) it works and B) it is easy to implement.
>
>Problem is that the language I have in mind is everything but simple:
>- There is no keywords, only predefined constants and objects.
>- There is only two type of commands: variable assignment and function
>calls
>- There is no constructs, conditional jumps, loops and declarations
>are done through function calls.
>- Also you can create types (classes in Java/C# terminology) at
>runtime.
>- types and functions are objects so you can pass them as arguments to
>a functions.
>- you can also create code blocks and passes them to a function (this
>is how if-else works for example).
>
>C static nature won't allow me to use it as an intermediary language,


In fact, probably it will.


With the exception of your object model - which you haven't described
much at all - the rest of your language is a simple "continuation
passing style" (CPS) functional model. There are a few stack
management tricks needed to efficiently implement CPS code in C, but
it is not difficult to do.


For inspiration you can investigate Scheme-> and Lisp-> compilers.
There are a number of them that work by first transforming the program
into a CPS form and then compiling that to C.




>LLVM or GCC probably fall under the same category, I thinking about
>modifying a Javascript interpreter or using it as is throught the eval
>function. Maybe all this is too much for me to do alone, anyone here
>interested in this challenge?


Other than the fact that a lot of programmers find CPS "unnatural" to
work with directly - meaning you might be the only one ever to use
your language - what you appear to be proposing doesn't sound very
difficult at all.


Because C is a suitable target for most of your language - with the
object model TBD, I'd expect you to have a first cut of your compiler
running end-to-end inside of a month (part time).


George


Post a followup to this message

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