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 6363199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:00:26+00:00 2026-05-25T00:00:26+00:00

What is this called, when a program takes source code as an input and

  • 0

What is this called, when a program takes source code as an input and spits out new source code and perhaps immediately runs the new code?

Examples:

  1. Automated refactoring
  2. Taking a function and turning it into a GUI (turning the function inputs into input boxes)
  3. Adding new capabilities to a function, like result caching.

The easiest languages to do this with are functional languages with simple syntax, right? (lisp, scheme, etc.)?

But you can do it with any language or between languages as long as you can parse source code into a tree or other data structure, right? (Using antlr or some other tool?)

So, what is this called? What are other examples of doing this, both big and small? What are some common tools? Please give me a jumping off point for thorough understanding of this type of programming.

(I am trying to leverage what I, as a single programmer, one pair of hands, can do, by writing code that will do things with my code.)

  • 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-25T00:00:27+00:00Added an answer on May 25, 2026 at 12:00 am

    What you are interested in are “source-to-source” program transformation systems.

    A parser is necessary but hardly sufficient. (In fact, a parser for your dialect of the langauge you are using is necessary… given that people use so many “programming” languages, this is a lot of parsers necessary). You also need to capture the parse result (generally as a tree), be able to manipulate that tree somehow, and then regenerate valid source code from the tree. If you want that source code to be a permanent change to source manually programmed, the parser/tree/unparser combination must preserve code formatting and comments to maximal extent practical.

    Often you can’t really transform code unless the meaning of the identifiers is clear; so in practice you need to not only parse but construct symbol tables (at this point you have what amounts to a compiler front end, not a parser). Many transformations require tracking information flows (control flow, dataflow, points-to, who-calls, …). Without these features, these tools are not very effective for the procedural/OO languages that constitute by far the bulk of source code. (The functional languages guys can get by with less flow analysis because everything is an expression, but most code written isn’t functional, so this doesn’t matter in a practical sense).

    There are a number of source-to-source transformation systems, some language specific (e.g., JackPot for Java); a few are parameterized by langauge definitions (TXL, Stratego, DMS).

    Some of the langauge specific one provide symbol tables and flow analysis. I know of only one transformation that provides these capabilities for a number of programming languages, and that’s our DMS Software Reengineering Toolkit.

    DMS provides this for a number of real programming languages and their common dialects, not toys: C, Java, COBOL.

    DMS is one of the few source-to-source program transformation system for C++; it has been used in anger to make changes to large C++ programs. Clang is pretty close, I think, certainly in ambition; Rose Compiler is another used mostly in supercomputing circles, but both of these are C++ (perhaps with C thrown in) specific.

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

Sidebar

Related Questions

I expected A::~A() to be called in this program, but it isn't: #include <iostream>
I have this class called SiteAsyncDownload.cs Here's the code: public class SiteAsyncDownloader { WebClient
I'm working on a program that takes a redirected file as input. For example,
This is currently my MySQL UPDATE query, which is called from program written in
Looking for help on writing a Perl program that takes an input file and
My program has a main thread that takes command input from a user. Separately,
I came across this term - Quine (also called self-reproducing programs). Just wanted to
I'm creating a Shell Script, and I have a file like this called expressions.txt
I called this function once per frame and it took my FPS from >400
I use this tool called Lazy C++ which breaks a single C++ .lzz file

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.