Forum > General

Does FPC uses any intermediate representation?

(1/2) > >>

Hi folks

I am working on a toy compiler and was wondering if I can use FPC as its backend. Does FPC uses any kind of IR that I can generate?
I read about the old Pascal codebases using p-code, but I couldn't find if there was a way for me to input pcode into fpc executable.

AFAIK: no.



--- Quote from: Bart on June 04, 2023, 10:46:54 pm ---AFAIK: no.

--- End quote ---
Mnemonics ? though we could discuss if that can be considered intermediate

No, it afaik goes from tree representation to asmlists, which is a kind of proto assembler

I think there's some sort of representation in the .ppu files in support of generics, but it should be considered private: it would be an extremely unwise programmer who dabbled in such things without the support of the core team.

It's easy enough to emit to and later interpret an intermediate format ** , but my own feeling is that one would be far better off learning an established form such as LLVM.

** Been there done that repeatedly. Make sure that the first opcode is a version identifier to keep the compiler and interpreter matched.



[0] Message Index

[#] Next page

Go to full version