Extending GNU C extensions
Michael Gong
mwgong@cs.utoronto.ca
Mon Sep 25 21:47:00 GMT 2006
We used gentle compiler construction system to build an AspectC compiler (
www.aspectc.net ), which is a source-to-source translation tool and
introduce the concept of Aspect-Oriented Programming ( AOP ) methodology to
C.
But if you only add small sugars to C, in my opinion, using gentle system
might be overkill.
Hope this helps.
----- Original Message -----
From: "Amit Choudhary" <amit2030@yahoo.com>
To: <gcc-help@gcc.gnu.org>
Sent: Monday, September 25, 2006 1:44 PM
Subject: Re: Extending GNU C extensions
>
> In my opinion, you can use macros for some of the things, and
> then write a program in perl to pre-process the code, before
> invoking gcc, to convert the rest of the new constructs to GNU C
> constructs. But there may be other options.
>
> Hope this helps.
>
> Regards,
> Amit
>
> --- Alpt <alpt@freaknet.org> wrote:
>
>>
>> Hi there,
>>
>> I'd like to extend the syntax of GNU C with few basic
>> constructs.
>> Their main purpose is to simplify the use of repetitive
>> statements and to add
>> some syntax sugar (but not to much).
>> All the new constructs can be converted to normal GNU C.
>>
>> The idea is to use a translator that converts the new syntax
>> to the GNU C one,
>> in this way, it can be compatible to gcc.
>>
>> What is the best way to achieve this?
>> Using flex&bison, M4, the sources of gcc, perl regexp, a
>> specific tool?
>>
>> What I'm looking for is a simple way to translate this new
>> simple syntax to
>> GNU C, without rewriting a compiler.
>>
>>
>> These are some of the new syntax constructs:
>>
>> - Struct
>>
>> element<-struct = value; ==> struct->element = value;
>>
>> element<`struct = value; ==> struct.element = value;
>> struct`>element = value; ==> struct.element = value;
>>
>> - High Level Boolean Logic
>>
>> A &|| B ==> (A && B) || (A || B)
>> In english it's the same of: A and/or B
>>
>> (A && |B, C, D, E|) ==> (A && B) || (A && C) || (A && D)
>> || (A && E)
>> (A || |B, C, D, E|) ==> (A || B) || (A || C) || (A || D)
>> || (A || E)
>> ==> A || B || C || D || E
>>
>> (A || &B, C, D, E&) ==> (A || B) && (A || C) && (A || D)
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
More information about the Gcc-help
mailing list