Pascal To C converter.

I need to make my own pascal to c converter. so, what would be the main steps i would have to follow? guidelines and advice needed too.

P.S. since, this is a project of mine, i'd have to do it myself...i know about Dave Gillespie's p2c.

Thanks.
joeDreamAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BatalfCommented:
Listening......
0
joeDreamAuthor Commented:
to what?
0
curriCommented:
First to note there is probably NO complete mapping between Pascal and C (although I'm not sure about it :). You can make a decent translator though

The way I would go about it, I would parse the Pascal code, make an Abstract Syntax Tree, and generate C code from that.

For making the AST, the work is usually divided between lexing and parsing. You can use Lex and Yacc for that. There are lex/yacc grammars for several different Pascal versions ...

In fact, you may want to get the source for a Pascal compiler, like FreePascal (http://www.freepascal.org/), and modify only the output phase.

And a decent book on compiler construction would surely help :)

Hope this helps
0
sumant032199Commented:
I think you will need to generate a language traslator. As a full time project it can be a good practice of string manupulation. Only thing required is a great database of the keywords of both the languages and format of standard functions.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Pascal

From novice to tech pro — start learning today.