GithubHelp home page GithubHelp logo

lua-pb's Introduction

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.

lua-pb's People

Contributors

catwell avatar hishamhm avatar janakj avatar neopallium avatar sravan2j avatar tgregory avatar usrben avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.