Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/05/07 12:37
Read: times


 
#136677 - Pascal to C conversion?
Responding to: ???'s previous message
Steve,


Someone once proved that you can convert any Turing complete language to any other Turing complete language. There are several programs available to convert from Pascal to C. You may have "p2c" already installed on a local Linux machine. I used it back in college in the early 90's to convert some finite difference groundwater modeling code I'd written to C. I was pleasantly surprised when it improved the performance significantly. (It was really badly written... ala... "You mean I can pass a reference to an array?")

A large commercial project I'm familiar with had pretty good results, but they used a team of programmers to guide the converter, and help it along. It was a 1+ million line threaded Pascal project. I don't know what tool they used for the conversion.

Link to p2c.

This may help you, but I suspect it won't quite get the "embedded syntax" found in '51 code.

To complete the answer to your question, a compiler usually goes thru the following steps:

1. Lexical analyzer
2. Syntax analyzer
3. Semantic analyzer
4. Intermediate code generation
5. Code optimization
6. Code generation

Each of these steps interfaces to a symbol table that tracks each of the various idetifiers/attributes defined in the program. The GCC compiler has multiple "front ends" that implement steps 1 thru 4. This is how they implement C, C++, Pascal, Ada, and Fortran. All of them end up using the same back end code generators & optimizers.


(Getting waaaay... outside my field too...)

Rob

List of 11 messages in thread
TopicAuthorDate
Is 8051 Pascal dead?            01/01/70 00:00      
   Hmm            01/01/70 00:00      
      not really...            01/01/70 00:00      
         are you saying...            01/01/70 00:00      
            no            01/01/70 00:00      
               Open source            01/01/70 00:00      
                  I just wrote an email to Rainier...            01/01/70 00:00      
                     Crossed fingers...            01/01/70 00:00      
                        theoretically...            01/01/70 00:00      
                        Pascal to C conversion?            01/01/70 00:00      
   Is 8051 Pascal dead?            01/01/70 00:00      

Back to Subject List