简体   繁体   中英

Parsing C# in scripting language

I'd like to write some simple scripts which will parse C# code and modify it or mayby for the begining, pull some interesting parts.

Is there any library for, ex. Python, to do that? I know there are few libraries (in NRefactor there is something to build AST from C#), but i'd like something for script langs - parse and build AST or something like that.

I don't know if this exists for Python. Nor do I understand your "script" langauge constraint; Python is a full language.

Our DMS Software Reengineering Toolkit and its C# Front End can parse C# in its various dialects including C# 4.0, build ASTs, and renerate valid C# code from those ASTs.

The DMS machinery will let you procedurally visit/inspect/modify the ASTs using DMS's "scripting" language, PARLANSE. Or you can use DMS's ability to apply pattern-directed source-to-source program transformations written directly using C# syntax to help you make changes to the AST more conveniently.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM