MCPcopy
hub / github.com/chai2010/go-ast-book

github.com/chai2010/go-ast-book @main sqlite

repository ↗ · DeepWiki ↗
396 symbols 916 edges 123 files 104 documented · 26%
README

《Go语言定制指南》(原名:Go语法树入门)

  • 凹语言(专为 WebAssembly 设计): https://github.com/wa-lang/wa
  • WaBook(Go语言实现的MD电子书构建工具): https://github.com/wa-lang/wabook

Go语法树是Go语言源文件的另一种语义等价的表现形式。而Go语言自带的go fmtgo doc等命令都是在Go语法树的基础之上分析工具。因此将Go语言程序作为输入数据,让我们语法树这个维度重新审视Go语言程序,我们将得到创建Go语言本身的技术。Go语法树由标准库的go/ast包定义,它是在go/token包定义的词法基础之上抽象的语法树结构。本书简单介绍语法树相关包的使用。如果想从头实现一个玩具Go语言可以参考《从头实现µGo语言》

  • 作者:柴树杉,Github @chai2010,Twitter @chaishushan
  • 作者:史斌,Github @benshi001
  • 作者:丁尔男,Github @3dgen
  • 主页:https://github.com/chai2010/go-ast-book
  • 阅读:https://chai2010.cn/go-ast-book

购买链接:

  • 京东:https://item.jd.com/13698866.html
  • 当当:https://product.dangdang.com/29388202.html
  • 异步:https://www.epubit.com/bookDetails?id=UBc86f749c1eb7

如果你喜欢本书,欢迎到豆瓣评论:

  • https://book.douban.com/subject/35852237

waBook 构建(纯Go语言实现)

增加了基于 Github 的 留言功能 构建:

  • https://github.com/wa-lang/waBook

然后执行 wabook serve 本地打开服务,或者 wabook build 构建。

微信公众号

版权

版权 柴树杉史斌丁尔男,保留相关权力。此内容仅针对Github平台用户免费在线阅读。

Extension points exported contracts — how you extend this code

CalcVisitor (Interface)
A complete Visitor for a parse tree produced by CalcParser. [2 implementers]
appendix/b-antlr4/calc/calc_visitor.go
Value (Interface)
Wa支持的值类型的抽象接口
ch14/examples/04-bi-op/watypes/value.go
CalcListener (Interface)
CalcListener is a complete listener for a parse tree produced by CalcParser. [1 implementers]
appendix/b-antlr4/calc/calc_listener.go
Value (Interface)
Wa支持的值类型的抽象接口
ch14/examples/06-import-func/watypes/value.go
IStartContext (Interface)
IStartContext is an interface to support dynamic dispatch. [1 implementers]
appendix/b-antlr4/calc/calc_parser.go
Value (Interface)
Wa支持的值类型的抽象接口
ch14/examples/05-branch/watypes/value.go
IExpressionContext (Interface)
IExpressionContext is an interface to support dynamic dispatch. [1 implementers]
appendix/b-antlr4/calc/calc_parser.go
Value (Interface)
Wa支持的值类型的抽象接口
ch14/examples/03-frame/watypes/value.go

Core symbols most depended-on inside this repo

push
called by 10
appendix/b-antlr4/stack.go
pop
called by 10
appendix/b-antlr4/stack.go
getValue
called by 9
ch14/examples/06-import-func/run.go
getValue
called by 9
ch14/examples/05-branch/run.go
getValue
called by 7
ch14/examples/04-bi-op/run.go
Eval
called by 5
ch3/examples/02/main.go
Eval
called by 5
ch3/examples/01/main.go
visitRule
called by 5
appendix/b-antlr4/visitor.go

Shape

Function 199
Method 147
Struct 38
Interface 11
FuncType 1

Languages

Go100%

Modules by API surface

appendix/b-antlr4/calc/calc_parser.go65 symbols
appendix/a-goyacc/examples/calculator/calc.y.go16 symbols
ch14/examples/06-import-func/run.go13 symbols
ch14/examples/02-global-var/run.go13 symbols
appendix/b-antlr4/calc/calc_base_listener.go13 symbols
ch14/examples/05-branch/run.go12 symbols
ch14/examples/04-bi-op/run.go12 symbols
ch14/examples/03-frame/run.go12 symbols
appendix/b-antlr4/calc/calc_listener.go9 symbols
ch14/examples/06-import-func/watypes/value.go6 symbols
ch14/examples/05-branch/watypes/value.go6 symbols
ch14/examples/04-bi-op/watypes/value.go6 symbols

Dependencies from manifests, versioned

github.com/antlr/antlr4v0.0.0-2020101023252 · 1×
github.com/llir/llvmv0.3.2 · 1×
golang.org/x/toolsv0.0.0-2020060117563 · 1×

For agents

$ claude mcp add go-ast-book \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact