cactorium/rust-ast-debug


Rust compiler plugin that generates relatively readable AST for inspection

Language: Rust


Build Status

Mistakes were made!

So I kind of impulsively added this to crates.io, without thinking too much about adding more functionality, so if you've got a project that you want to name ast-debug and think would be awesome than this, let me know and we'll work out a way for your project to replace mine.

Introduction

This compiler plugin takes a function and adds a println! to the top of it which a string that contains the AST of the function when it's passed through the Rust parser.

Example!

#![feature(plugin)]
#[plugin] extern crate ast_debug;

ast!(fn foo() {
	println!("Hello world!");
});

becomes

fn foo() {
	println!(" /* A lot of somewhat pretty printed AST info ends up here! */ ");
	println!("Hello world!");
}

Current Issues

Compiler plugins are currently an unstable feature, so you'll need the nightly version of Rust to use them. The current code also ends up stripping away a bit of the function data, namely the ABI, unsafe, and the generics. These will probably be fixed eventually!

Project Statistics

Sourcerank 2
Repository Size 145 KB
Stars 0
Forks 0
Watchers 2
Open issues 0
Dependencies 0
Contributors 1
Tags 0
Created
Last updated
Last pushed

Top Contributors See all

Kelvin Ly

Packages Referencing this Repo

ast_debug
Rust compiler plugin that prints out the AST of a function
Latest release 0.1.0 - Published

Something wrong with this page? Make a suggestion

Last synced: 2017-09-03 07:37:13 UTC

Login to resync this repository