samonzeweb / go2ast

Transform Go code into it's AST

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to go2ast 👋

Version License: MIT Twitter: reflog

Transform Go code into it's AST

Usage

echo "a := 1" | go run main.go

Example output

[]ast.Stmt {
        &ast.AssignStmt {
                Lhs: []ast.Expr {
                        &ast.Ident {
                                Name: "a",
                        },
                },
                Tok: :=,
                Rhs: []ast.Expr {
                        &ast.BasicLit {
                                ValuePos: 30,
                                Kind: INT,
                                Value: "1",
                        },
                },
        },
}

WASM Demo

Try this live: https://reflog.github.io/go2ast/

Author

👤 Eli Yukelzon

About

Transform Go code into it's AST


Languages

Language:Go 100.0%