ast_viewer
Version, currently 0.1.32 versions
- 0.1.4latestNov 5, 2018
- 0.1.3not indexedNov 5, 2018
github.com/arcage/ast_viewer.cr
Visualize the AST structure from ASTNode object, source file, or source code string.
9 stars
0 dependents
License: MIT
Nothing has been indexed for 0.1.3 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
ast_viewer:
github: arcage/ast_viewer.cr
version: ~> 0.1.3Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.3. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# AST Viewer for Crysal
Visualize the AST structure from ASTNode object, source file, or source code string.
The target compiler version is **0.27.0**.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
ast_viewer:
github: arcage/ast_viewer.cr
```
## Usage
```crystal
require "ast_viewer"
# From ASTNode object
viewer = ASTViewer.from_node(node_object)
# From source file
viewer = ASTViewer.from_file("source_file.cr")
# From source code string
source_code = <<-SRC
def foo(bar : Int32) : String
bar.to_s
end
buz = foo(0)
SRC
viewer = ASTViewer.from_source(source_code)
puts viewer
```
Result exapmle:

If you doesn't want to colorize the output, set `colorize` property to `false`:
```crystal
viewer.colorize = false
```
When the AST is parsed from the source code that has **syntax** error, the error message simillar to the compile time error will be displaied.
Result example 2(`a = [1, 2, 3` is given):
```prain
Syntax error in :1: expecting token ']', not 'EOF'
a = [1, 2, 3
^
```
## Notice
This shard will parse source code on the **syntax** level only, not the semantic level.
- Any AST transformations are not applied. (`require` file, `unless` to `if` conversion ...)
- Semantic errors are not checked. (method existence, type mismatch ...)
## Contributors
- [arcage](https://github.com/arcgae) ʕ·ᴥ·ʔAKJ - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.3- Tagged
- Nov 5, 2018
- Commit
6ccb94ab3593- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/arcage/ast_viewer.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 2