Question

I want to write a simple compiler for educational purposes in Delphi. I have read about Coco/R and found this implementation for Delphi: http://code.google.com/p/dcocor/ . From what I have read, this is a parser for the Delphi 2009 syntax.

What would I have to do to turn the parsed file into a bytecode? Can Coco/R do this?

I know about scripting languages like FastScript or DWS, but I'd like to try and write my own for my own purposes.

Please give me some advice or clarify things a little.

Was it helpful?

Solution

What would I have to do to turn the parsed file into a bytecode?

First, decide what kind of bytecode would you like to have: JVM? LLVM? MSIL? Inventing your own?

Can Coco/R do this?

Coco/R is a parser generator framework, it only generates lexer-parser for a language you define and feed to the generator. Steps after that is your responsibility. Though there might be projects out there that can help generating ast/target code (but I haven't found any for Coco/R ).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top