Re: Parsing partial sentences

Kaz Kylheku <>
Sun, 30 Apr 2017 16:31:52 +0000 (UTC)

          From comp.compilers

Related articles
[14 earlier articles]
Re: Parsing partial sentences (George Neuner) (2017-04-21)
Re: Parsing partial sentences (Walter Banks) (2017-04-27)
Re: Parsing partial sentences (Kaz Kylheku) (2017-04-27)
Re: Parsing partial sentences (Hans-Peter Diettrich) (2017-04-28)
Re: Parsing partial sentences (2017-04-28)
Re: Parsing partial sentences (Marco van de Voort) (2017-04-29)
Re: Parsing partial sentences (Kaz Kylheku) (2017-04-30)
| List of all articles for this month |

From: Kaz Kylheku <>
Newsgroups: comp.compilers
Date: Sun, 30 Apr 2017 16:31:52 +0000 (UTC)
Organization: NNTP Server
References: 17-04-001 17-04-023 17-04-024 17-04-027
Injection-Info:; posting-host=""; logging-data="77038"; mail-complaints-to=""
Keywords: translator, C, Pascal
Posted-Date: 30 Apr 2017 15:38:44 EDT

On 2017-04-29, Marco van de Voort <> wrote:
> On 2017-04-27, Kaz Kylheku <> wrote:
>>> In a word NO. #defines are always strings even when they look like
>>> constants, something I have found out the hard way. There have only been
>>> two ways that I have successfully dealt with #defines: a preprocessor
>>> pass or later and much faster pipeline the processing of C source and
>>> add the defined definition processing into part of the source fetch
>>> handling.
>> If we allow Pascal to be extended with a macro preprocessor,
> I think most interest in C->Pascal header translators is for (semi)automated
> translation of 3rd party library headers, not converting complete programs.

OP wrote that he's writing a C to Pascal translator. The face value
interpretation of that is that it handles programs.

Handling only headers would be the likely focus of a project for
automatically generating Pascal foreign function interface bindings
for C libraries: C to Pascal interface translation (C la SWIG and

> This means that it cannot be considered a given that a program exists that
> uses all macros in the header.

A macro that is not used by a C program might be complete gibberish;
yet that program may still be well-formed.

      #define ABC { ( 42 -> * "foo" ]

A C to Pascal translator which tries to treat unused macros might
needlessly choke on such a thing.

It is reasonable, nay wise, for a whole-program C to Pascal translator
to ignore C macros that are unused by the C program.

Post a followup to this message

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