ID:1758983
 
Applies to:
Status: Open

Issue hasn't been assigned a status value.
Right now I'm faced with the daunting task of writing a code analyzer that takes a DM file and processes it line-by-line to get a list of available objects, procs, and vars.

There's an option in dm.exe that allows you to print an object tree in XML format, but when dealing with large projects such as SS13 this is horribly slow.

I'm hoping to avoid having to write something myself, but instead use the compiler to process the project files instead, while maintaining a good speed even in large projects.

I don't know where the bottlenecks are that cause the compiler to be so slow when dealing with projects such as SS13. I know that I don't actually need the compiler to create a .dmb/.rsc file for me, all I'm interested in is any errors/warnings and the full object tree with all possible procs/vars for the project including built-in procs and vars.

If it's not feasible to make the tool any faster, would it be possible to allow for incremental compilation? How I think it would work is that the dm.exe tool would process everything at first the way it does now, but allow saving the results to a file. Later I could call the tool with the results file and a list of modified files, and it would only scan the modified files for changes and apply them to the existing resultset.

And if that's not feasible then I'd like it if (parts of) the Dream Maker source-code could be provided (at least for me if not open-source) so I can copy the parts that analyse code / generate the object tree from that.

Is any of this possible?
Well, if you don't need the top level vars, you should be able to efficiently build the entire object tree at runtime using typesof() and the vars lists, but that's not easy.

Also, I don't think there's a way to get the argument names for procs or verbs at runtime.
I need the top-level variables, and I can't write this in BYOND code (can't afford the time it would take to compile large projects like SS13) -- it has to either be a built-in functionality that the compiler supports (preferred, because then the burden of maintenance falls on BYOND Staff to update the internal DM Reference and potential changes to syntax) or I'll be forced to write a code analyzer to parse DM files.