Re: Intermediate forms (again?): worthwhile?

tm <>
Mon, 24 Jan 2011 23:33:41 -0800 (PST)

          From comp.compilers

Related articles
[13 earlier articles]
Re: Intermediate forms (again?): worthwhile? (Tony) (2011-01-22)
Re: Intermediate forms (again?): worthwhile? (Bartc) (2011-01-23)
Re: Intermediate forms (again?): worthwhile? (Steven Shaw) (2011-01-24)
Re: Intermediate forms (again?): worthwhile? (Steven Shaw) (2011-01-24)
Re: Intermediate forms (again?): worthwhile? (Barry Kelly) (2011-01-24)
Re: Intermediate forms (again?): worthwhile? (Tony) (2011-01-24)
Re: Intermediate forms (again?): worthwhile? (tm) (2011-01-24)
Re: Intermediate forms (again?): worthwhile? (Chris Dollin) (2011-01-26)
Re: Intermediate forms (again?): worthwhile? (Bartc) (2011-01-26)
Re: Intermediate forms (again?): worthwhile? (BGB) (2011-01-26)
| List of all articles for this month |

From: tm <>
Newsgroups: comp.compilers
Date: Mon, 24 Jan 2011 23:33:41 -0800 (PST)
Organization: Compilers Central
References: 11-01-045
Keywords: code
Posted-Date: 26 Jan 2011 12:17:51 EST

On 14 Jan., 06:53, "Tony" <> wrote:
> Clarification: I got to here from disenchantment/unenamorment with
> existing HLLs (yep, every one of them). I like the freedom afforded by
> writing to the hardware level for my language's
> initial/prototype/reference output.

Does this mean your language will be close to the hardware or
your compiler will generate code close to the hardware?

The implementation strategy depends on the features of your language.
E.g.: Emitting code directly from the parser is only possible when
your language allows it. Pascal was designed that it can be compiled
that way. Features like type inferencing or using things without or
before the declaration require some intermediate representation. As
John said a tree representation is a good idea.

Besides optimisation considerations the language features may force
you to use more or less complex intermediate representations.

Does you language differ from existing ones by syntactical
Do you want that statements, declarations, etc. look different and
have slightly other meanings? In this case you could write a
preprocessor for an existing language or modify an existing
compiler. The P4 Pascal compiler is quite simple so a modification is
not too hard (but it does not generate machine code). Maybe an
extensible language like Seed7 could help you. You could define
statements, declaration constructs, operators and other stuff for your
language. This way you can concentrate on the features of your
language and you get an interpreter and a compiler for free. The
features of your language would be defined in an include file. Your
programs would start with including this file and afterwards your
language constructs are available. A short explanation is here:
This is not the main direction of Seed7 but it can be used that way.
How to define the syntax and semantic of a statement is explained
Even when you are not interested in implementing your language this
way it still can be helpful to create prototypes. Maybe you can try
some of your statements this way. Some time ago somone asked for
a loop with a middle exit. So I did a prototype for it. See:

If you have questions, just ask.

Greetings Thomas Mertes

Seed7 Homepage:
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.

Post a followup to this message

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