SourceGo: Golang to SourcePawn Transpiler (v1.4 beta)
I'm happy to announce that, with the help of many SM devs, I've created an experimental Golang to SourcePawn source to source compiler aka a transpiler.
What does it do? It takes (a subset of) Golang code and converts it to an equivalent SourcePawn version, here's a quick example: Code:
/// SourceGo Code:
/// Generated SourcePawn: The transpiler itself is written in Golang and can easily be cross-compiled for Windows 32-bit, 64-bit and Linux/Mac 32-bit, 64-bit from the Go compiler directly. The project is MIT licensed and is currently in open Alpha phase. The purpose of this project is to help automate and abstract over many SourcePawn constructs in order to significantly improve plugin development time. Part of this is stronger typing & type abstraction and a simpler, more expressive syntax. Project Repo. An important thing to remember is that, with SourceGo, you're not making SourceMod plugins with Golang, you're using Golang's syntax that is then transformed into its SourcePawn equivalent code. |
Re: SourceGo: Experimental Golang to SourcePawn Transpiler
I look forward to seeing where this goes :)
|
Re: SourceGo: Experimental Golang to SourcePawn Transpiler
This looks pretty interesting. I've seen lots of interest with Rust nowadays, but GoLang is something I definitely would love to see having SourcePawn support.
Also looking forward to this! :bee: |
Re: SourceGo: Experimental Golang to SourcePawn Transpiler
In terms of what SourceGo is capable of, here's an example using a receiver, returning multiple values, and assigning multiple values.
Code:
type PlayerInfo struct { Code:
enum struct PlayerInfo { |
Re: SourceGo: Experimental Golang to SourcePawn Transpiler
Update v0.20a. Ranged for-loops are now supported.
Code:
var clients [MAXPLAYERS+1]Entity |
Re: SourceGo: Experimental Golang to SourcePawn Transpiler
another update, v0.22A, added two types of switch statements: normal and "true" switch statements.
Normal is of course what you'd expect: Code:
/// Original: Code:
/// Original: |
Re: SourceGo: Experimental Golang to SourcePawn Transpiler
alright, with version v0.25a.
Here's a sample of a plugin that modifies the mantreads damage written in "SourceGolang" and the code it generated: Code:
package main Code:
/** |
Re: SourceGo: Experimental Golang to SourcePawn Transpiler
After exactly a week of time gone, I have finally managed to abstract function pointers to where they appropriately break down to manual function calling API:
Code:
func main() { Code:
public void OnPluginStart() { |
Re: SourceGo: Golang to SourcePawn Transpiler (v1.4 beta)
good news, SourceGo aka Go2SourcePawn, is now in open beta at version 1.4
It now has a complete SourceMod interface file for being able to use SM's natives in a Golang-way. SourceGo also has a built-in function `__sp__` for inlining SourcePawn code that can't be replicated from SourceGo: PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
Re: SourceGo: Golang to SourcePawn Transpiler (v1.4 beta)
This looks very interesting! Is it possible to write transpiler SourcePawn -> GoLang? Is it planned?
|
All times are GMT -4. The time now is 07:59. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.