| Crates.io | oak-go |
| lib.rs | oak-go |
| version | 0.0.1 |
| created_at | 2025-10-22 05:52:07.897995+00 |
| updated_at | 2026-01-23 04:28:21.906178+00 |
| description | High-performance incremental Go parser for the oak ecosystem with flexible configuration, supporting concurrent programming and cloud-native development. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 1895036 |
| size | 127,184 |
High-performance incremental Go parser for the oak ecosystem with flexible configuration, optimized for static analysis and code generation.
Oak Go is a robust parser for Go, designed to handle complete Go syntax including modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for static analysis and code generation.
Basic example:
use oak_go::{Parser, GoLanguage, SourceText};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let parser = Parser::new();
let source = SourceText::new(r#"
package main
import "fmt"
func main() {
fmt.Println("Hello, Go!")
}
"#);
let result = parser.parse(&source);
println!("Parsed Go successfully.");
Ok(())
}
use oak_go::{Parser, GoLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
func add(a, b int) int {
return a + b
}
"#);
let result = parser.parse(&source);
println!("Function parsed successfully.");
use oak_go::{Parser, GoLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
type Person struct {
Name string
Age int
}
func (p *Person) Greet() {
fmt.Printf("Hello, I'm %s and I'm %d years old\n", p.Name, p.Age)
}
"#);
let result = parser.parse(&source);
println!("Struct parsed successfully.");
use oak_go::{Parser, GoLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new("x := 42");
let result = parser.parse(&source);
// Token information is available in the parse result
use oak_go::{Parser, GoLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
func main() {
fmt.Println("Hello, Go!")
// Missing closing brace
"#);
let result = parser.parse(&source);
if let Err(e) = result.result {
println!("Parse error: {:?}", e);
}
The parser generates a comprehensive AST with the following main structures:
Oak Go integrates seamlessly with:
Check out the examples directory for comprehensive examples:
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.