Skip to content

Instantly share code, notes, and snippets.

@suma
Created January 12, 2011 03:26
Show Gist options
  • Save suma/775641 to your computer and use it in GitHub Desktop.
Save suma/775641 to your computer and use it in GitHub Desktop.
thrift parser output AST and symbols
input =
namespace java my.first.idl
namespace cpp my.first.idl
struct Column {
1: required string name;
2: required string value;
3: required i64 timestamp;
4: optional i32 ttl;
}
struct SuperColumn {
1: required string name;
2: required list<Column> columns;
}
== definitions
IDLNamespace(java,my.first.idl)
IDLNamespace(cpp,my.first.idl)
IDLStruct(Column,List(StructMember(1,name,TypeString(),true), StructMember(2,value,TypeString(),true), StructMember(3,timestamp,TypeInt64(),true), StructMember(4,ttl,TypeInt32(),false)))
IDLStruct(SuperColumn,List(StructMember(1,name,TypeString(),true), StructMember(2,columns,TypeList(TypeSymbol(Column)),true)))
== registered symbols
(double,TypeDouble())
(i16,TypeInt16())
(i32,TypeInt32())
(string,TypeString())
(i8,TypeInt8())
(i64,TypeInt64())
(SuperColumn,TypeSymbol(SuperColumn))
(Column,TypeSymbol(Column))
(bool,TypeBoolean())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment