Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neopallium/lua-pb
Lua Protocol Buffers
https://github.com/neopallium/lua-pb
Last synced: about 4 hours ago
JSON representation
Lua Protocol Buffers
- Host: GitHub
- URL: https://github.com/neopallium/lua-pb
- Owner: Neopallium
- License: mit
- Created: 2011-06-17T03:43:16.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2018-05-31T14:59:37.000Z (over 6 years ago)
- Last Synced: 2024-05-02T13:21:19.893Z (5 months ago)
- Language: Lua
- Homepage:
- Size: 170 KB
- Stars: 287
- Watchers: 28
- Forks: 95
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
lua-pb
=======Lua Protocol Buffers.
Supports dynamic loading of Protocol Buffer message definition files `.proto`
Installing
----------$ sudo luarocks install "https://raw.github.com/Neopallium/lua-pb/master/lua-pb-scm-0.rockspec"
Design
------Frontend `.proto` definition file parser:
* pb/proto/scanner.lua -- LPeg lexer for `.proto` files.
* pb/proto/util.lua -- some utility functions.
* pb/proto/grammar.lua -- LPeg grammar for `.proto` files.
* pb/proto/parser.lua -- LPeg based `.proto` -> AST tree parser.There can be multiple Backend message definition compilers. An optimized backend for LuaJIT
is planned.Standard backend compiler
* pb/standard.lua -- main compiler code.
* pb/handlers.lua -- a helper object for managing registered encode/decode formats.
* pb/standard/message.lua -- defines message interface.
* pb/standard/repeated.lua -- defines repeated field interface.
* pb/standard/pack.lua -- binary format encoding (Uses modules luabitops & struct)
* pb/standard/unpack.lua -- binary format decoding (Uses modules luabitops & struct)
* pb/standard/buffer.lua -- encoding buffer
* pb/standard/unknown.lua -- object for hold unknown fields.
* pb/standard/dump.lua -- message dumping code.Finished
--------
* .proto definition parser
* Message encoding/decoding
* Dumping messages to text format.
* Support for packing/unpacking unknown fields.TODO
----* rename pb/handlers.lua to pb/formats.lua
Missing features:
* custom options:
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
optional string my_option = 51234;
}
message MyMessage {
option (my_option) = "Hello world!";
}* services
Improvements:
* store unknown fields as raw binary, only fully decode when accessed.
* LuaJIT optimized backend compiler.