Skip to content

Commit 7cdec36

Browse files
committed
Update readme
1 parent 51b54ee commit 7cdec36

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
The goal of Ocaml protoc plugin is to create plugin for
55
the google protobuf compiler (`protoc`) to generate Ocaml types and
6-
serialization and de-serialization functions from a `.proto`
6+
serialization and deserialization functions from a `.proto`
77
file. Ocaml-protoc-plugin aims to be a fully compliant implementation
8-
of the google protobuffer standard and guidelines.
8+
of the Google protobuf standard and guidelines.
99

1010
The main features include:
1111
* Messages are mapped to idiomatic OCaml types, using modules
@@ -18,6 +18,8 @@ The main features include:
1818
* Configurable annotations for all generated types
1919
* Json serialization and deserialization based on protobuf
2020
specification
21+
* Implemented in pure Ocaml. making the library usable with `js-of-ocaml`, `melange`, etc.
22+
2123

2224
## Comparison with other OCaml protobuf handlers.
2325

@@ -138,7 +140,7 @@ protoc --plugin=protoc-gen-ocaml=../plugin/ocaml-protocol-plugin.exe --ocaml_out
138140
### Json serialization and deserialization
139141
Ocaml-proto-plugin can serialize and deserialize to/from
140142
json. Using the function `to_json`, `from_json` and
141-
`from_json_exn` similar to regular protobuffer serialization and
143+
`from_json_exn` similar to regular protobuf serialization and
142144
deserialization.
143145

144146
Json serialization can be controlled using optional arguments:
@@ -153,7 +155,7 @@ to limit number of dependencies.
153155

154156

155157
The `options` argument allows finer grained control over json
156-
serialization. The followin options are supported:
158+
serialization. The following options are supported:
157159

158160
| argument | comment | default |
159161
|---|---|---|
@@ -183,7 +185,7 @@ as close as possible:
183185
| google.protobuf.Any | | Not handled, as the ocaml-protobuf-plugin does not support dynamic protobuf parsing |
184186

185187

186-
Json serialization and deserializaiton is not well optimized and
188+
Json serialization and deserialization is not well optimized and
187189
should not be used in performance critical applications.
188190

189191
### Older versions of protoc
@@ -202,7 +204,7 @@ into somewhat more Ocaml idiomatic names. When this option is set (see
202204
below), names are mangled to snake case as described in the table
203205
below:
204206

205-
| Protobyf type | Protobuf name | Ocaml name |
207+
| Protobuf type | Protobuf name | Ocaml name |
206208
|:--------------|:-------------------------|:-------------------------|
207209
| package | `CapitalizedSnakeCase` | `Capitalized_snake_case` |
208210
| message | `CapitalizedSnakeCase` | `Capitalized_snake_case` |
@@ -220,14 +222,14 @@ name to make sure names are unique.
220222

221223
The algorithm for converting CamelCased names to snake_case is done by
222224
injecting an underscore between any lowercase and uppercase character
223-
and then lowercasing the result.
225+
and then lowercase the result.
224226

225227
### Setting mangle option
226228
Name mangling option can only be controlled from within the protobuf
227229
specification file. This is needed as protobuf files may reference each
228230
other and it its important to make sure that included names are
229231
referenced correctly across compilation units (and invocations of
230-
protoc).
232+
`protoc`).
231233

232234
To set the option use:
233235
```protobuf
@@ -247,11 +249,11 @@ message MyProtoMessage { }
247249
```
248250

249251
### Deprecation annotations in proto files
250-
Protobug specification (.proto file) allow for deprecating *files*,
252+
Protobuf specification (.proto file) allow for deprecating *files*,
251253
*enums*, *enum values*, *messages*, *message fields*, *services* and
252254
*methods*.
253255

254-
These deprecations are kept in the ocaml mapping to generate
256+
Deprecation annotations are preserved in the ocaml mapping to generate
255257
[alerts](https://ocaml.org/manual/alerts.html) for alert category
256258
'protobuf'.
257259

@@ -346,12 +348,12 @@ serializing and deserializing the embedded message.
346348

347349
## Proto3 Optional fields
348350
Proto3 optional fields are handled in the same way as proto2 optional
349-
fields; The type is an option type, and always transmissted when set.
351+
fields; The type is an option type, and always transmitted when set.
350352

351-
## Imported protofiles
353+
## Imported proto-files
352354
The generated code assumes that imported modules (generated from proto
353355
files) are available in the compilation scope. If the modules
354-
generated from imported protofiles resides in different a different
356+
generated from imported proto-files resides in different a different
355357
scope (e.g. is compiled with `wrapped true`, they need to be made
356358
available by adding parameter `open=<module name>` to make the modules
357359
available for the compilation.
@@ -364,7 +366,7 @@ be used by linking with the package `ocaml-protoc-plugin.google_types`, and addi
364366
option `open=Google_types` to the list of parameters
365367

366368
The distributed google types are compiled using default parameters,
367-
i.e. without any ppx annotations.
369+
i.e. without any `ppx` annotations.
368370

369371
If you want to change this, or add type annotations, you can copy the
370372
[dune](https://github.com/andersfugmann/ocaml-protoc-plugin/tree/main/src/google_types/dune)
@@ -465,7 +467,9 @@ More examples can be found under
465467

466468
# Benchmarks
467469

468-
ocaml-protoc-plugin has been optimized for speec, and is comparable [ocaml-protoc](https://github.com/mransan/ocaml-protoc)
470+
ocaml-protoc-plugin has been optimized for speed, and is comparable
471+
[ocaml-protoc](https://github.com/mransan/ocaml-protoc) in terms of
472+
performance.
469473

470474
Numbers below shows benchmark comparing encoding and decoding speed to
471475
`ocaml-protoc`. The benchmark is run with flambda settings: `-O3 -unbox-closures -unboxed-types -remove-unused-arguments -rounds 4 -inline 100.00 -inline-max-depth 5 -inline-max-unroll 5 -unsafe`. Benchmarks are made on a Intel i5, i5-5257U CPU

0 commit comments

Comments
 (0)