Skip to content

Sample and notes for Go Abstract Syntax Tree parsing and modification

Notifications You must be signed in to change notification settings

wesionaryTEAM/go-ast-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go AST Example

Sample and notes for go abstract tree parsing and modification.

Reference Tutorials:

  • Go Ast Traversal here
  • Go Ast Manipulation here

Packages

  • go/token: Defines constants representing the lexical tokens of the go programming language and basic operations on tokens (printing, predicates) "gopher" -> token.String
  • go/scanner Implements scanner for go source text. Takes []byte and tokenize through repeated calls to scan method.
  • go/ast declares types used to represent abstract syntax tree.
  • go/parser Parses go source file and outputs AST. Parser package uses scanner and token package itself.
  • go/printer prints ast in human readable format

ast.Inspect inspect traverses the ast node.

About

Sample and notes for Go Abstract Syntax Tree parsing and modification

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages