Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 193297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:29:55+00:00 2026-05-11T16:29:55+00:00

If I wanted to modify or add my own extensions to C, and add

  • 0

If I wanted to modify or add my own extensions to C, and add them to the GCC C compiler, what would I need to do? I do not want to propose changes to the language, I want to know how the C compiler actually works.

I’ve had a look at the source code to GCC and it looks as if Objective-C is implemented as a simple parser that generates code that makes references to a modified runtime library and then for everything that is C-based it uses the regular C compiler. I haven’t studied it intensely so I’m probably not on the right track.

Say for example, I wanted to add my own keyword to Objective-C, just for fun. I want to add something that seems easy to implement, like maybe @assert. All I want is for @assert to call a function that I will add to the Objective-C runtime:

objc_runtime_assert (__FILE__, __LINE__, expression, "string version of expression");

Obviously I could just implement this as function call and macro anyway, but I want to gain an understanding of the parsing and compilation stages of C source code, and maybe so I could add my own extensions to a language for my own use.

The source code I have looked at consistently refers to “trees” and there are many, many macros that perform actions or obtain information from these trees.

Is there any documentation around that explains this sort of thing in-depth?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:29:55+00:00Added an answer on May 11, 2026 at 4:29 pm

    The trees are most likely abstract syntax trees (AST) and any compiler book will teach that. The dragon book is a very classic one, at the class I took we used The essence of compilers by Robin Hunter, ISBN 0-13-727835-7. You should also be able to find tons of material from different colleges and universities with some good search terms (compiler design, AST, lexical analysis, top-down parsing, bottom-up parsing, semantic analysis, LL, LR).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I know that EF entities track their own changes and persist them to
I have a need to add metadata about a HABTM relationship. I wanted to
I wanted to modify a column in a sql server 2005 table to IDENTITY(1,1)
Wanted to see if anyone knows how to add props to a image with
I wanted to know about Data Type implementation in PHP so I need a
I wrote a numerical simulation and, as a tweak, I wanted to add some
I'm creating a nested model in Rails, but I want to add fields to
I wanted to modify/customize the android framework. I am a complete newbie in framework
Is there ways to modify the appearance of the title area. Can you add
I am trying to add a small 3 box news segment. I wanted it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.