dmd support for IDEs
Jeremie Pelletier
jeremiep at gmail.com
Sat Oct 10 22:27:39 PDT 2009
Walter Bright wrote:
> Jeremie Pelletier wrote:
>> I think it would be great, but XML is only one format and a heavy one
>> at that, JSON for example is much lighter and easier to parse. It
>> shouldn't be hard to support both.
>
> I'd never heard of JSON, but looking at it, it makes sense. I don't see
> much point in supporting both.
XML makes sense when saving as a file and it can be transformed by XSLT
to generate formatted html documentation and whatnot, while JSON is
lightweight and better suited for pipes between dmd and the IDE.
>> However I would make the file generation optional, as the IDE might
>> just want to read from the standard output stream of dmd instead, this
>> would also be useful for shell scripts.
>
> Yes, writing it to stdout as an option is a good idea.
>
>
>> Support to get the semantics information of multiple files at once
>> would also be neat, just like dmd can generate one object file from
>> multiple source files.
>
> Yes.
>
>> Would it even be possible to have the C api behind the xml/json
>> frontends exported in a dll, so IDEs could just dynamically link to it
>> and call that API directly instead of parsing an intermediary text
>> format.
>
> I did that with the C++ compiler, and it's a big pain to support. I
> don't think it would be onerous to fork/exec the compiler to do the
> work, capture the output, and parse it.
The IDE usually keeps the files in memory and could therefore just call
something like getSemantics(char** fileBuffers, int* fileSizes, int
nFiles, ParseNode* parseTree) and have its parse nodes already allocated
in process memory ready for use.
Considering a lot of IDEs like to re-parse the current file every time
the keyboard is idle for a few seconds, this could really help
performance, nothing is more annoying than an IDE that feels unresponsive.
More information about the Digitalmars-d
mailing list