[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Beginner's tinycc questions

From: grischka
Subject: Re: [Tinycc-devel] Beginner's tinycc questions
Date: Fri, 22 Jan 2021 18:28:36 +0100
User-agent: Thunderbird (Windows/20090812)

I B via Tinycc-devel wrote:

I am just beginning to play with tinycc. I want to modify the compiler
and add some new language features (for leaning purposes).

I have a few questions:
1. What is the status of tinycc being re-entrant? Has that
been merged?

No, it isn't.  It should be thread-safe but not re-entrant.
On unix you could probably use 'fork' to run a second instance
of the compiler while parsing.

2. I want to do some compiler time evaluation. For example
(@comptime is just my simple parsing extension)

..... regular C code ....

@comptime {

  .... some code ....


..... continue C code

I want to evaluate code inside @comptime{ } while parsing. The code inside
can generate some more C code and inject it back (and it needs to be compiled).

Question: What's the best way to do this with tinycc?

The answer might depend very much on the real code.
... some/more/regular/... can be anything.

Parse and compile the entire file first, then execute the code and create a 
source new file?
(so, there would be two passes)

Or is there a way to inject new source while tinycc is parsing?

Any suggestions are appreciated.

I would suggest first to write a fully 'working' example of what
you have in mind.  As if the compiler that has all the experimental
features that it needs to run it, already would exist.

--- grischka



reply via email to

[Prev in Thread] Current Thread [Next in Thread]