Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Coco/R turn a parsed file into bytecode?

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.

like image 351
Pateman Avatar asked Mar 04 '12 11:03

Pateman


1 Answers

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 ).

like image 119
LeleDumbo Avatar answered Nov 17 '22 23:11

LeleDumbo