Horace
Horace

Reputation: 1208

In which language is the proto compiler (of google protocol buffers) written?

I would like to know in which language the "proto compiler" (the compiler used to generate source files from Java, Python or c++) is written? Is it maybe a mix of languages?

Any help would be appreciated.

Thanks in Advance Horace

Upvotes: 3

Views: 756

Answers (2)

Bruce Martin
Bruce Martin

Reputation: 10543

The protoc compiler is written in C or C++ (its a native program anyway).

When I want to process proto files in java files, I

  1. I use the protoc command to convert them to a Protocol Buffer File ie

    protoc protofile.proto --descriptor_set_out=OutputFile

  2. Read the new protocol buffer file (its a FileDescriptorSet) and use it

An over complicated example is example, is compileProto method in

http://code.google.com/p/protobufeditor/source/browse/trunk/%20protobufeditor/Source/ProtoBufEditor/src/net/sf/RecordEditor/ProtoBuf/re/display/ProtoLayoutSelection.java

its compilcated because options because the protoc command and options can be stored in a properties file.

Note: The getFileDescriptor method reads the newly created protocol buffer

Upvotes: 1

Jerry Coffin
Jerry Coffin

Reputation: 490088

It appears to be written in C++. There's also documentation on Java and Python APIs, but those don't appear to contain the compiler itself (at least I don't see anything that's obviously the compiler in either case, though I didn't spend a whole lot of time looking for it either).

That said, I'm almost tempted to vote to close -- for most practical purposes, the language used to implement the compiler is basically a trivia question, irrelevant to actual use. There is, however, an entirely legitimate exception: if you're going to download and modify the compiler, knowing the language you'd need to work with could be quite useful.

Upvotes: 2

Related Questions