Skip to content

Instantly share code, notes, and snippets.

@hanneskaeufler
Created January 22, 2019 14:25
Show Gist options
  • Save hanneskaeufler/a24c6af41b7442ab238a6a01904b64f1 to your computer and use it in GitHub Desktop.
Save hanneskaeufler/a24c6af41b7442ab238a6a01904b64f1 to your computer and use it in GitHub Desktop.
Getting AST from string
require "compiler/crystal/syntax/*"
code = <<-CODE
def hello
puts "hello"
end
CODE
ast = Crystal::Parser.parse(code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment