| Reproducible bug report for the Rust frontend in Code-Transpiler 5375d17 nandi 5h ago | 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "encoding/json" |
| 5 | "fmt" |
| 6 | "os" |
| 7 | "regexp" |
| 8 | |
| 9 | "github.com/tarekwasfy01/Code-Transpiler/v2/internal/backend" |
| 10 | ) |
| 11 | |
| 12 | func main() { |
| 13 | code, _ := os.ReadFile(os.Args[2]) |
| 14 | p, err := backend.ParseSemantic(os.Args[1], string(code)) |
| 15 | fmt.Println("err:", err) |
| 16 | if p == nil || p.UniversalAST == nil { |
| 17 | return |
| 18 | } |
| 19 | b, _ := json.Marshal(p.UniversalAST) |
| 20 | re := regexp.MustCompile(`"kind":"([A-Za-z]+)"`) |
| 21 | counts := map[string]int{} |
| 22 | for _, m := range re.FindAllStringSubmatch(string(b), -1) { |
| 23 | counts[m[1]]++ |
| 24 | } |
| 25 | fmt.Println("node kinds:", counts) |
| 26 | } |