nandi/rustnimpublic Fork 0
3d4a7d283b83d3a5305dfc6654c290bd4ee162ae
Commits
Clone
git clone https://git.rickub.com/nandi/rustnim.git
git clone ssh://git@rickub.com/nandi/rustnim.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Scaffold rustnim: Rust->Nim transpiler, type mapping 1a218c2 · on 3d4a7d283b83d3a5305dfc6654c290bd4ee162ae · nandi · 12h ago
main.go · 26 lines · 552 BGo Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main

import (
	"encoding/json"
	"fmt"
	"os"
	"regexp"

	"github.com/tarekwasfy01/Code-Transpiler/v2/internal/backend"
)

func main() {
	code, _ := os.ReadFile(os.Args[2])
	p, err := backend.ParseSemantic(os.Args[1], string(code))
	fmt.Println("err:", err)
	if p == nil || p.UniversalAST == nil {
		return
	}
	b, _ := json.Marshal(p.UniversalAST)
	re := regexp.MustCompile(`"kind":"([A-Za-z]+)"`)
	counts := map[string]int{}
	for _, m := range re.FindAllStringSubmatch(string(b), -1) {
		counts[m[1]]++
	}
	fmt.Println("node kinds:", counts)
}