Re: [swift-dev] swift module format

2017-08-27 Thread Coder via swift-dev
> You say this, but... I really hate for you to spend a lot of time on > something that is so low-level and that is so likely to be unstable. I think > it would make a lot more sense to write a C API to the AST and talk to it > over the OCaml FFI. Or if you really want to avoid the FFI, you co

Re: [swift-dev] swift module format

2017-08-24 Thread John McCall via swift-dev
> On Aug 25, 2017, at 2:34 AM, Slava Pestov wrote: >> On Aug 24, 2017, at 10:56 PM, John McCall via swift-dev > > wrote: >> >> Or if you really want to avoid the FFI, you could take our current ASTDumper >> output, which is currently pseudo-machine-readable, and make

Re: [swift-dev] swift module format

2017-08-24 Thread Slava Pestov via swift-dev
> On Aug 24, 2017, at 10:56 PM, John McCall via swift-dev > wrote: > > Or if you really want to avoid the FFI, you could take our current ASTDumper > output, which is currently pseudo-machine-readable, and make it actually > machine-readable. The elegant approach there would be to take the e

Re: [swift-dev] swift module format

2017-08-24 Thread John McCall via swift-dev
> On Aug 25, 2017, at 1:41 AM, Coder via swift-dev wrote: > I’m working on a swift target for haxe and want it to use the interfaces in > swift modules. The haxe compiler is written in ocml and so far I’ve created > an llvm bitcode parser in ocaml which can read all the blocks and records, > th

Re: [swift-dev] swift module format

2017-08-24 Thread Coder via swift-dev
I’m working on a swift target for haxe and want it to use the interfaces in swift modules. The haxe compiler is written in ocml and so far I’ve created an llvm bitcode parser in ocaml which can read all the blocks and records, then read through the DECLS_AND_TYPES_BLOCK and map DECLS to their pa

Re: [swift-dev] swift module format

2017-08-24 Thread Slava Pestov via swift-dev
Yeah, it’s important to keep in mind we don’t have a stable module format right now, so anything developed Swift 4 will likely need to be revised again with the next version. The C++ API is not stable either, but approach could be to dump the ‘generated interface’ using swift-ide-tool or simila

Re: [swift-dev] swift module format

2017-08-24 Thread Argyrios Kyrtzidis via swift-dev
Hi, What are you trying to do exactly ? Have you considered reading the decls with a tool using the C++ APIs (load a module and iterate over the decls) ? I think that would be easier and more future-proof. > On Aug 22, 2017, at 11:57 AM, Coder via swift-dev wrote: > > Hello, > > I’m working o

[swift-dev] swift module format

2017-08-22 Thread Coder via swift-dev
Hello, I’m working on extracting information from .swiftmodule files. Currently I can read all blocks and records but I’m having trouble identifying all DECLs in the DECLS_AND_TYPES_BLOCK. Below is a bcanalyzer dump of a swifmodule file created from this one line of code: class Example {} A