This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Extending GNU C extensions
- From: Amit Choudhary <amit2030 at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 25 Sep 2006 10:44:33 -0700 (PDT)
- 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