The go-ruby-prism is package that leverages the Ruby Prism parser compiled to WebAssembly for parsing Ruby code without the need for CGO.
- CGO-Free: Go-Ruby-Prism utilizes the Ruby Prism parser compiled to WebAssembly, eliminating the need for CGO bindings.
- Simplified Integration: Seamlessly integrate Ruby code parsing into your Go applications with minimal setup.
- High Performance: Harnesses the efficiency of WebAssembly for speedy and efficient parsing of Ruby code.
- Cross-Platform: Works across various platforms supported by Go, ensuring compatibility in diverse environments.
Here's a basic example demonstrating how to use this package:
package main
import (
"context"
"fmt"
parser "github.com/danielgatis/go-ruby-prism/parser"
)
func main() {
ctx := context.Background()
p, _ := parser.NewParser(ctx)
source := "puts 'Hello, World!'"
result, _ := p.Parse(ctx, source)
fmt.Println(result)
}
You can find more examples in the examples folder.
Copyright (c) 2024-present Daniel Gatis
Licensed under MIT License