Related articles |
---|
Automatically generating ASTs with XML markup mcollado@fi.upm.es (Manuel Collado) (2004-12-29) |
Re: Automatically generating ASTs with XML markup dido@imperium.ph (Rafael 'Dido' Sevilla) (2004-12-30) |
Re: Automatically generating ASTs with XML markup Juergen.Kahrs@vr-web.de (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2004-12-30) |
Re: Automatically generating ASTs with XML markup demakov@ispras.ru (Alexey Demakov) (2004-12-30) |
Re: Automatically generating ASTs with XML markup jones@cs.ua.edu (Joel Jones) (2004-12-30) |
From: | "Alexey Demakov" <demakov@ispras.ru> |
Newsgroups: | comp.compilers |
Date: | 30 Dec 2004 01:00:18 -0500 |
Organization: | Compilers Central |
References: | 04-12-149 |
Keywords: | tools, XML |
Posted-Date: | 30 Dec 2004 01:00:18 EST |
I'm planning to implement this feature in TreeDL tool
http://treedl.sourceforge.net But you have to specify AST structure
explicitly, not BNF (In fact, the same AST can be built from different
BNFs) in form of
node Program
{
child ID name;
child Import* importList;
child Declaration* declList;
child Body body;
}
node Import
{
child ID name;
}
node Body
{
child Stmt* stmtList;
// name is not required in AST,
// it is used only before AST construction
}
node Call
{
child ID name;
child Expr* expr;
}
node ID
{
attribute string name;
}
abstract node Stmt
{
}
node IfStmt : Stmt { ... }
node ForStmt : Stmt { ... }
Describing AST structure takes almost the same efforts as BNF
but gives more control over AST - you can specify children names,
skip unneeded parts (as final <name> in block).
AST structure can be translated in Java or C#.
If you're interested - write me to all-x@users.sourceforge.net
Regards,
Alexey
-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com
----- Original Message -----
From: "Manuel Collado" <mcollado@fi.upm.es>
Sent: Wednesday, December 29, 2004 9:46 AM
Subject: Automatically generating ASTs with XML markup
> I'm trying to grab the abstract syntax of several code samples in
> several different languages by using an XML representation.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.