A simple tool for vlang, generate v source file to AST json file.
so you can see the AST of v source file.
NOTE:
the vast will follow the newest version of V, If you meet error,please update the V source code from:https://github.com/vlang/v
-
via vpm
v install lydiandy.vast -
via source
git clone git@github.com:lydiandy/vast.git ln -s your/path ~/.vmodules/vastnow you can run the example code in example directory
cd example v run ./main.vit will parse the demo.v file and generate demo.json, open it ~
module main
import vast
fn main() {
file:='./demo.v'
//generate json file with the same name
vast.json_file(file)
//or generate ast string
ast_str:=vast.json(file)
println(ast_str)
}- make type from id to name
- make enum from id to name
MIT
pull request is welcome ~
