:books: 《Go语法树入门——开启自制编程语言和编译器之旅》(开源免费图书/Go语言进阶/掌握抽象语法树/Go语言AST/凹语言)

Go语法树入门——开启自制编程语言和编译器之旅!


蚂蚁金服招聘云原生方向和编程语言方向岗位(杭州/P7):云原生方向要求熟悉k8s配套工具,如kubectl、kustomize、kubebuilder,operator;编程语言方向要求对语言对语言解释器(如py/js/lua/wasm等)、工具链、配套SDK有一定兴趣和实践经验。欢迎各位同学咨询或推荐(推荐成功独享全额推荐红包)。联系方式 [email protected], [email protected]


Go语法树是Go语言源文件的另一种语义等价的表现形式。而Go语言自带的go fmtgo doc等命令都是在Go语法树的基础之上分析工具。因此将Go语言程序作为输入数据,让我们语法树这个维度重新审视Go语言程序,我们将得到创建Go语言本身的技术。Go语法树由标准库的go/ast包定义,它是在go/token包定义的词法基础只是抽象的语法树结构。本书简单介绍语法树相关包的使用(出版社已经约稿出版本书,并在开源版本的基础之上增加了语义信息、SSA形式、LLVM和凹语言等内容,因为出版社版权问题不方便全部公开新增内容)。

在线阅读

版权

版权 柴树杉史斌丁尔男,保留相关权力。针对Github注册用户提供以下的优惠权利:

  1. Github平台免费在线阅读。
  2. 关注本书项目(Star),同时关注任意一个作者的 Github 或 推特账号,自动获得下载的权利。

禁止非 Github 平台转载,作者保留相关法律权利。

Owner
chai2010
《Go语言高级编程》《Go语法树入门》《WebAssembly标准入门》作者
chai2010
Similar Resources
Comments
  • 章节1.3 FileSet和File的描述让人感到困惑

    章节1.3 FileSet和File的描述让人感到困惑

    每个FileSet表示一个文件集合,底层抽象为一个一维数组,... FileSet中的每个File元素对应底层数组的一个区间,...

    这句话我看到时,将“FileSet的files字段”“这个抽象的一维数组” 划上了 等号。因为该字段正好是一个一维数组,且每个元素就是个File结构体指针。在这个前提下,本章节后面的内容一度让我非常困惑,直到最后,我才意识到,这个“一维数组”是不存在的。感觉这里的表述也许可以改进一些。

  • 在第一章1.3节关于FileSet和File的描述的疑问

    在第一章1.3节关于FileSet和File的描述的疑问

    原文为

    在每个File内部可以通过offset定位下标索引,通过offset+File.base可以将File内部的offset转换为Pos位置。因为Pos是FileSet的全局偏移量,反之也可以通过Pos查询对应的File,以及对应File内部的offset。

    图画为: image

    是不是应该为:

    在每个File内部可以通过offset定位下标索引,通过File.offset+FileSet.base可以将File内部的offset转换为Pos位置。因为Pos是FileSet的全局偏移量,反之也可以通过Pos查询对应的File,以及对应File内部的offset。

    如果是我理解错误,请大佬指正。

    求大佬解惑! @chai2010

Simple authentication and books management with GoFiber

Simple authentication and books management with GoFiber Simple authentication system with gofiber. Endpoints GET /api - Welcome message POST /api/auth

Nov 27, 2022
Scrape the web in the eink era. Convert websites into books.

Scrape the web in the eink era. Convert websites into books.

Dec 29, 2022
Monkey programming language project from 'Writing An Interpreter In Go'and 'Writing A Compiler In Go' Books
Monkey programming language project from 'Writing An Interpreter In Go'and 'Writing A Compiler In Go' Books

Monkey Monkey programming language ?? project from "Writing An Interpreter In Go

Dec 16, 2021
Simple script for farm free books from PackPub.com

Bookgot BookGot is a simple boot for farm free books from PACKTPUB.COM #Install go get -u github.com/bregydoc/Bookgot Usage First import BookGot //..

Mar 26, 2019
Go-ticket-booking-app - Simple CLI application which books tickets for a Go conference made to learn the fundamentals of Go programming language.

go-ticket-booking-app Simple CLI application which books ticket for a Go conference made to learn the fundamentals of Go programming language. Gorouti

Jan 2, 2022
Limit-order-book - Limit order books keep records of orders for a given symbol to be traded

Limit Order Book Limit order books keep records of orders for a given symbol to

Jan 17, 2022
Simple-API-Golang for Books

Simple-API-Golang for Books

Jan 25, 2022
Back end of e-books and papers collection website. Only for internal use.

Back end of e-books and papers collection website. Only for internal use.

Nov 1, 2022
Books-rest api - Simple CRUD Rest API architecture using postgresql db with standard Library

books-rest_api Simple CRUD Rest API architecture using postgresql db with standa

Feb 8, 2022