How does peachpie work? (i need just a rough explanation) #1073
-
Hello, here a member of the otterkit team, we are in the very early stages of development, we are trying to build a compiler with similar features but for COBOL since we'd like to "free" it from its proprietary nature and giving it away under MIT license while having some fun (it also would be kinda cool having cobol work alongside peachpie and C# someday) i know that peachpie is based on roslyin but looking at the docs at https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/get-started/syntax-analysis i found only tools to build an AST and some analysis things and nothing that allows to actually interact with the Intermediate Language (IL) Does peachpie transpile PHP to C# or it uses custom built tools or something? maybe it works with this tool to transpile stuff https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, thanks for the question! Public Roslyn API does not allow creating your own languages (it's basically hardcoded for C#, F#, and VB.NET). So we have forked Roslyn's CodeAnalysis project, added [InternalsVisibleTo] so we can actually build a new language on top of Roslyn's IL builders and Symbols. PeachPie is not a transpiler, it really emits its own metadata and produces regular DLL assemblies using low-level Roslyn metadata generators and IL builders. Nothing like "source generators" wouldn't be sufficient to compile PHP code. In majority of places, PeachPie compiler produces IL byte-code that has no equivalent in C# language (such as dynamic call sites, or PHP interfaces containing some members that are not allowed in C#, but IL allows them just fine) |
Beta Was this translation helpful? Give feedback.
Hi, thanks for the question!
Public Roslyn API does not allow creating your own languages (it's basically hardcoded for C#, F#, and VB.NET).
So we have forked Roslyn's CodeAnalysis project, added [InternalsVisibleTo] so we can actually build a new language on top of Roslyn's IL builders and Symbols.
PeachPie is not a transpiler, it really emits its own metadata and produces regular DLL assemblies using low-level Roslyn metadata generators and IL builders. Nothing like "source generators" wouldn't be sufficient to compile PHP code. In majority of places, PeachPie compiler produces IL byte-code that has no equivalent in C# language (such as dynamic call sites, or PHP interfaces containing s…