How to output an executable

I am writing a program that compiles some code and tries to output an executable file for windows/dos (I kow... do it in c... but the point is that at some later stage I want to port it to solaris/linux/unix/os2... ) so I wanted to know if someone knew how to write executable code to a disk file. Sample code will be appreciated.

Well I think that you will have to read the "Compiler Construction" book for the language who�s source code you are trying to compile. Generating an .exe file from a source code requires a lot of steps.
- Tokenizing
- Lexical Analysis
- Parsing (top down, bottom up, recursive, non-recursive, forward chaining, desent, predictive, non-predictive, multi-threaded etc. etc. are a few techniques to implement your parser)
- Generating two-address code
- Optimization
- Machine Language Conversion
- Assembling
- Linking
etc. etc.
And before you do all of this you have to know the complete Grammar of your language and then depending on the type of your parser you will have to create the first and follow sets and manage your state manipulations and error recovery techniques. You can find a lot of books on creating parsers for every available language in the market.
I implemented a compiler for Pascal in my college days (it was part of the curriculum, so no big deal.... ;-) ), two of the books I used that I still remember were
- Compiler Design by Renhard Wilhelm
- Principles and Practice of Compiler Construction by Kenneth Louden
Hope that I have not completely off shooted from the actual question.
Regards
Omer

Similar Messages

  • How to output full image path to logger/console

    Hi All
    I'm just starting to get my hands dirty with the lr sdk and could do with a little guidance.
    For part of a plugin I need to retrieve the full path to each image, and although I can achieve what I want I'm struggling to print the path to the console/logger and can't understand why.
    Here's a snippit of code to illustrate things:
    for photo in exportSession:photosToExport() do
         filename = photo:getFormattedMetadata( "fileName" )
         outputToLog( filename )  -- Works as expected
         folderName = photo:getFormattedMetadata( "folderName" )
         outputToLog( folderName )  -- Works as expected
         local path = LrPathUtils.standardizePath(photo:getRawMetadata("path"))
         outputToLog( path ) -- Output is always blank
         -- and yet when passed to exiftool the path is correct and works as expected
         LrTasks.execute("exiftool  -Copyright=\"Imaginary person\" \""..path.."\"")
    end
    Basically I can get the path and use it as part of an exiftool command, but can't work out how to output the path to the log/console for debugging purposes. Am I missing something simple or is this an intentional limitation?
    Any help much appreciated.

    I don't know what the problem is. What device are you outputting to?
    i.e. did you try logger:enable( "logfile" ) -- that works for me in OSX to log to a file.
    Here is the code I use:
    self.logger = LrLogger( logName )
    local function logToFile( msg )
        local f = io.open ( self.logFilePath, "a" )
        if f == nil then
            Debug.pause( "can't open log file", self.logFilePath )
            return
        end
        f:write ( LrDate.timeToUserFormat( LrDate.currentTime(), "%Y-%m-%d %H:%M:%S"), " ", msg, '\n' )
        f:close ()
    end
    if self.verbose then
        --self.logger:enable( 'logfile' ) -- enable everything to log file.
        self.logger:enable( logToFile )
    else
        local actions = {
            -- debug output is suppressed when not logging verbosely
            trace = logToFile,
            info = logToFile,
            warn = logToFile,
            error = logToFile,
            fatal = logToFile,
        self.logger:enable( actions ) -- suppress trace & debug.
    end
    R

  • How to output a output type?

    How to output a output type which is maintained at item's level in delivery note with transaction VL02N?
    tks in advance.

    Hi Huanzhiyu,
    First you check you are mainataining condition record for that output type or not in VV22 transaction if not maintain condition record.
    After that,
    Go to VL02N transaction enter your delivery number then go to Menu >Outbound delivery>Issue Delivery Output.
    If not happen
    Go to inside of the delivery  select item then go to menu>Extras>Delivery output-->Click on Item here you maintain the output details then execute output.
    I hope it will help you,
    Regards,
    Murali.

  • Output Designer Executable Problem When Compiling

    I am currently experiencing a problem compiling some templates, where the Output Designer crashes with the following message 'Output Designer Executable has encountered a problem and needs to close. We are sorry for the inconvenience.'
    I have been working with a number of templates and most have compiled successfully without any problem. However occasionally they are crashing where they previously worked before. I also experience this problem using Test Presentment.
    This crash is happening intermittently, but often enough to be causing me problems.
    My feeling is it something to do with XP and memory allocation for compiles but I have not got to the bottom of this.
    Can anyone give me any advice over this problem. Have any of you experienced this problem, if so how did you resolve it ?
    Is there any settings that would solve this ?
    Thanks
    Stephen

    Stephen,
    I am having a similar problem. Have you been able to figure it out yet?
    Thanks,

  • How to compile and execute a Pro*C program on Unix?

    Hello Gurus,
    I am new to Pro*C. I just wrote a sample Pro*C program 'first.pc' to read some information from some tables and print it on screen.
    I am not sure how to compile it and execute it to see the output of my very first program.
    After searching a lot I tried following ..
    -- Step 1 compile the program into .c program
    $->ls -lrt first.pc
    -rwxrwxrwx    1 sqloper4 staff          1069 Oct 31 03:39 first.pc
    $->proc first.pc
    Pro*C/C++: Release 8.1.7.0.0 - Production on Sat Oct 31 05:43:35 2009
    (c) Copyright 2000 Oracle Corporation.  All rights reserved.
    System default option values taken from: /oracle/app/oracle/product/8.1.7/precomp/admin/pcscfg.cfg
    $->ls -lrt first*
    -rwxrwxrwx    1 sqloper4 staff          1069 Oct 31 03:39 first.pc
    -rw-r--r--    1 sqloper4 staff             0 Oct 31 05:43 first.lis
    -rw-r--r--    1 sqloper4 staff          6648 Oct 31 05:43 first.c
    $->
    -- Step 2 Generate the .o file
    $->cc -I${ORACLE_HOME}/precomp/public -c first.c
    first.c: In function 'main':
    first.c:154: warning: return type of 'main' is not 'int'
    $->
    $->ls -lrt first*
    -rwxrwxrwx    1 sqloper4 staff          1069 Oct 31 03:39 first.pc
    -rw-r--r--    1 sqloper4 staff             0 Oct 31 05:43 first.lis
    -rw-r--r--    1 sqloper4 staff          6648 Oct 31 05:43 first.c
    -rw-r--r--    1 sqloper4 staff          3709 Oct 31 05:45 first.o
    $->
    -- Step 3 After that link the .o to libraries and produce the exe
    $->cc -o exe_name -L $ORACLE_HOME/lib -lclntsh
    ld: 0711-317 ERROR: Undefined symbol: .main
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
    collect2: ld returned 8 exit status
    $->
    $->ls -lrt first*
    -rwxrwxrwx    1 sqloper4 staff          1069 Oct 31 03:39 first.pc
    -rw-r--r--    1 sqloper4 staff             0 Oct 31 05:43 first.lis
    -rw-r--r--    1 sqloper4 staff          6648 Oct 31 05:43 first.c
    -rw-r--r--    1 sqloper4 staff          3709 Oct 31 05:45 first.o
    $->After all above still I am not sure how to proceed and 'execute' the program.
    Could you please help me with the steps to 'Compile and execute' a Pro*C program ?
    Oracle DB Version : Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
    OS : Unix
    Thanks in advance!

    Hi All,
    After reading Pro*C Question thread I have tried below steps to compile my .C program, but failed with the given errors
    $->cc -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib first.c -o sample
    ld: 0711-317 ERROR: Undefined symbol: .sqlcxt
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
    collect2: ld returned 8 exit statusAfter receiving above error I tried below command as an alternative
    $->cc -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib first.c -o first -lclntsh -lsql10
    collect2: library libsql10 not foundCould you please help in resolving above error? Whats missing exactly?

  • How to remove the 'Execute' Icon

    Dear Friends ,
                    Good Morning.
    Can anybody know how to remove the Execute Icon?Pls. help on this.

    Hi !
    Assuming it's a report... you can do the following:
    - Create an new "PF-Status" for your report
      Use "Extras -> Adjust Template" from the menu
      and select "Selection-Screen" from that...
    - Exclude all the buttons and functions you don't like
      having there
    - In your report so something like that:
    PBO
      AT SELECTION-SCREEN OUTPUT.
      SET PF-STATUS '1000'.
      where '1000' in this example is your new pf-status.
    I've done that very often if you'd like to start execution by pressing ENTER.
    If you'd like to do somthing like that your coding has to be in "AT Selection-Screen" because there is no "START-OF-SELECTION" when you do not use he "execute" function, wich has the sy-ucomm ONLI.
    Hope that helped a bit.
    Some points would be nice then...
    Rainer

  • How to output sound to RCA cables?

    I give up! I can't for the life of me figure out how to output the sound from my Macbook to play on my stereo or TV which use RCA cable hook-ups.
    I got the VID ADPT MINI-DVI TO VIDEO ADAPTER-GEN but that only adapts the video, not the sound. Do I have to get some kind of optical to analog adapter?

    This would do the trick, although you can probably find something at Radio Shack for less.
    http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/RSLID?mco=FFB 21895&fnode=home/shopipod/ipod_accessories/cablesdocks&nplm=TN779LL/A
    I got an iPod kit with a power supply, extra dock, and a Monster Cable (yeah I think they're overhyped) mini jack to RCA connector.
    There are a bunch of ways you can do this. If you've already got long enough RCA cables, these would do the trick:
    http://www.radioshack.com/product/index.jsp?productId=2103710
    Or if you have a short distance, maybe something like this (doesn't say how long it is):
    http://www.radioshack.com/product/index.jsp?productId=2427991
    There are more attractive versions of this type of adapter. Radio Shack shows at least a dozen from different companies.

  • How GET Output to Excel with Oracle9i Report using OC4J

    how GET Output to Excel with Oracle9i Report using OC4J.
    I FINISHED THE SETPS CONCIDERING THE JSP CODE NEEDED TO GET THE EXCEL OUTPUT ON LOCAL MACHINE.
    I NEED TO PUBLISH THIS REPORT THROUGH APPLICATION SERVER.
    THE QUESTION IS:
    1- HOW TO START AN OC4J INSTANCE FROM ORACLE 9I DS FOR THIS REPORT?
    2- WHERE (PATH) TO PUBLISH THE REPORT ON THE APPLICATION SERVER?
    3- WHAT IS THE DEFAULT URL TO RUN THIS REPORT AND WHERE TO PUT IT?
    4- HOW TO MAKE MAPPING FOR DIRECOTRY PATH TO TRANSLATED AS URL FOR THIS REPORT?
    5- IF ANY ONE CAN GIVE ME THE FULL CODE TO RUN AND CALL SIMPLE JSP REPORT TO BE VIED IN INTERNET EXPLORER.
    THANK YOU

    Hi,
    I can't answer to all your questions, however I can tell you that:
    2) The directory where to put the report file is specifiend in a file named
    <serverName>.conf
    in the sourceDire property
    <property name="sourceDir" value="/directory/dove/mettere/i/report"/>
    that you can find under ORACLE_HOME/reports/conf
    3) The URL is
    http://<server IAS address>:<port number>/<jsp file path>/<repName>.jsp?server=<report server name>&userid=<user>/<pwd>@<DB conn string>[&<param>=<valore>[&...]]
    5) In IE you have only to set the previous URL in the address bar.
    Hope this helps you
    Bye
    Raffy

  • How to create and execute a function whose return value is  a table

    hi folks ,
    i would like know how to create and execute a function whose return value is a table ,
    am new to pl/sql ,
    my statement for the function is
    SELECT ct.credential_code, c.expiration_date
    FROM certifications c, credential_types ct
    WHERE ct.crdnt_id = c.crdnt_id
    AND c.person_id = person_id;
    i would like to have the result of the above query as return value for the function.
    Thanks in advance ,
    Ashok.c

    hi Ps ,
    Can you please do small sample ,
    that would help me in clear understanding
    thanks in advance
    ashok.c

  • How to output video to TV or Home Theatre? (iphone)

    How to output video to TV or Home Theatre? (iphone)

    I recently bought a AV projector and was asked by a smirky but envious friend the same question, after watching me hook up my powerbook, having already purchased an ipod video 30gig with the UNIVERSAL DOCK with remote control and ifrared remote control I remembered reading about it also working with the iphone, so it having a s-video output with a audio mini output port, I plugged the iphone into it and it came up with a little message saying this is not a iphone compatible device, and asked me to turn on airport, I ignored the request and it just clicked over to the itunes section, I picked a video and presto instant big screen projection TV off the iphone, How IMPRESSIVE! then I went to utube launched a utube video and wow how cool it also played seamlessly, although it pays to let the Youtube videos buffer for a minute to get a better play off the EDGE net work verse the Wi-Fi, I plan on having lots of out door theatre shows this summer with this very compact multi-media package, What a hoot! Get the universal dock no glitches!

  • How to output data when converting labview vi into matlab mex functions

    Hi,
    I am a fairly new user to labview and am currently working on labview
    7.1. I have created a labview vi which can extract data from ni daq
    6070e in real time. The problem is that this code has to be converted
    so that it can be used with matlab.in order to do that i am using math
    interactive tool kit which converts the labview code into mex files
    which can then be used in matlab. Unfortunately i have not been able to
    figure out how to output this data so that it can be processed in
    matlab easily. i cannot afford any loss of information and all the
    output must happen in real time. the o/p must take place after the fft
    has been done. i am attaching the vi for convenience.There are 10
    broken wires ,and this is the place where i want the o/p to be
    generated.
    Also do let me know if this vi can be further improved.
    Regards
    Attachments:
    RT_loop2ver4_working.zip ‏642 KB

    Manuj,
    You seem to have misunderstood the way in which LabVIEW processes data.  The code that you have produced will run in exactly the same way without the need for the case structure.
    The code does not actually run the data from the previous case. It is merely processing data from the previous loop iteration, regardless of the case. If you were to remove the case structure, leaving only one copy of the code intact, and remove the toggle switch you have produced, or used the shift register which, I assure you would have worked, then you will have exactly the same functionality.
    I have attached an example that uses the shift register to toggle cases, but also iterates that the case structure is not needed by using the same feedback node (and code) without a toggle switch or case structure.
    Hope this helps you optimize your code
    Regards
    AdamB
    Applications Engineer
    National Instruments UK
    Applications Engineering Team Leader | National Instruments | UK & Ireland
    Attachments:
    CASE_NO-CASE_Example.vi ‏24 KB

  • How to output FTP file with Code Page 8400?

    Hi gurus,
           As we know we can use  GUI_DOWNLOAD to download fiel with specific Code Page,
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
         filename          = 'E:\TEXT.TXT'
    *      confirm_overwrite = 'X'
          codepage          = '8400' "Chinese
        CHANGING
          data_tab          = i_file
        EXCEPTIONS
         file_write_error  = 1
          OTHERS            = 24.
      IF sy-subrc EQ 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    But my question is how to output file into FTP server with specific code page 8400?
      call function 'FTP_R3_TO_SERVER'
        exporting
          handle         = p_handle
          fname          = p_filename
          character_mode = 'X'
        tables
          text           = i_file
        exceptions
          tcpip_error    = 1
          command_error  = 2
          data_error     = 3
          others         = 4.

    Thanks but it is not my anwser
    I want to output file to FTP Server with specific code page like
    GUI_DOWNLOAD

  • How to Output Rich Text Format.

    Hi everyone, i use a rich text editor called tiny mce in my web application. After i click the submit button the value inside the text area would be saved in my database including the HTML tags e.g. <i>Sample Report edited via Tiny MCE Rich Text Editor<i>. I need to output the text in a webuijsf static text component but the moment i see the output the tags are still there and the text is not in italics format. Does anyone know how to output it in static text with the design in it?

    It is not updated for more than 1 years and it is dropped by Sun and users were recommended to migrate to ICEfaces.
    [http://woodstock.dev.java.net]
    The Woodstock release 4.2 is the last official version of Woodstock that Sun will release. Sun will continue to support its customers that have built on top of Woodstock 4.2. The Project Woodstock code is still available, and community members can still create new features or enhancements. For future development or migration of existing Woodstock projects, Sun is officially endorsing ICEfaces as the replacement technology for Woodstock. Also see [http://www.nabble.com/Woodstock-Migration-Path-to-ICEfaces-td21057513.html], although I would recommend RichFaces above that. It is only that it doesn't have a drag'n'drop palette for Netbeans, so it is not reachable for blind visual developers.

  • How to Output Rtf

    I need to create an app that reads text from text files and outputs the text to an rtf file, which will later be read into a Word document.
    Although my app will not contain any kind of UI, I've discovered that the javax.swing.text and javax.swing.text.rtf packages might let me accomplish my goals. I also found following snippet, which illustrates how to output some RTF:
    private void writeFile()
         FileOutputStream stream;
         try
              stream = new FileOutputStream("test.rtf");
              RTFEditorKit kit = new RTFEditorKit();
              Document doc = kit.createDefaultDocument();
              SimpleAttributeSet bold = new SimpleAttributeSet();
              StyleConstants.setBold(bold, true);
              doc.insertString(0, "TITLE", bold);
              doc.insertString(doc.getLength(), "\n\r" , null);
              doc.insertString(doc.getLength(), "Bla bla bla", null);
              doc.insertString(doc.getLength(), "bla bla bla", null);
              kit.write(stream, doc, 0, doc.getLength());
         catch (FileNotFoundException e)
              e.printStackTrace();
         catch (IOException e)
              e.printStackTrace();
         catch (BadLocationException e)
              e.printStackTrace();
    }What I need to do now is figure how to create the RTF for a table. Does anyone know how to do this?
    Thanks much...

    Hi pdevaal,
    Thanks for reply, For first question I test it and it works but it is possible to add MIMETYPE on server other wise I have to modify every Run report procedure for this to work.
    For second question I just view the slide show by Oracle to create template for spreadsheet output.
    Regards, Khawar

  • How to output new /new other than new/

    I use dom to parse a document to xml String.if a xml node doesn't have node value ,it will output <new/> but not <new></new>.we use this format (<new></new>) to transfer with remote mechine,so how to output this format.
    following is my sample code:
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = factory.newDocumentBuilder();
              Document document = builder.newDocument();
              Element root = document.createElement("root"); 
              document.appendChild(root); 
              Element child = document.createElement("new");
              root.appendChild(child);
              Transformer transformer = TransformerFactory.newInstance().newTransformer();
              Properties properties = transformer.getOutputProperties();
              properties.setProperty(OutputKeys.ENCODING, "utf-8");
              properties.setProperty(OutputKeys.METHOD, "xml");
              properties.setProperty(OutputKeys.VERSION, "1.0");
              properties.setProperty(OutputKeys.INDENT, "yes");
              properties.setProperty("{http://xml.apache.org/xslt}indent-amount", "4");
              transformer.setOutputProperties(properties);
              StringWriter sw = new StringWriter();
              transformer.transform(new DOMSource(document), new StreamResult(sw));
              System.out.println(sw.toString());I think that maybe to set some property to the transformer outputproperties.
    but I don't know what property will done.
    any suggestion is appreciated

    Thanks for your respons.My manager has accentuated this format before .maybe I will ask why.
    However I don't think it will done after adding child.appendChild(document.createTextNode(""));
    it still output <new/>.
    I have writed a function to format this xml String like this:
          * format <new/> String to <new></new>
          * @param xmlString
          * @return String
         public static String formatXml(String xmlString){
              int idx = xmlString.indexOf("/>");
              while(idx != -1){
                   String temp = xmlString.substring(0,idx);
                   int idx1 = temp.lastIndexOf("<");
                   String key = temp.substring(idx1+1,idx);
                   xmlString = xmlString.replaceAll("<" + key + "/>", "<" + key + "></" + key + ">");
                   idx = xmlString.indexOf("/>");
              return xmlString;
         }but i still won't to use it less than the end.

Maybe you are looking for