Articles | Open Access | DOI: https://doi.org/10.37547/tajas/Volume07Issue03-03

Swift Proto Parser: A Framework for Native Tools for Protocol Buffers

Kish Aleksei , Senior Software Engineer / Technical Owner at Semrush Spain, Barcelona

Abstract

This article presents the development of a native Swift library that parses .proto files—commonly used in Protocol Buffers (Protobuf)—without relying on the external protoc tool. It addresses a critical gap in Swift’s ecosystem by enabling direct, run-time access to Protobuf schemas. Drawing on the theoretical foundations of lexical analysis, the paper outlines how the library’s lexer and parser transform raw .proto input into descriptor structures amenable to dynamic serialization and integration with SwiftProtoReflect. The proposed approach substantially reduces dependency on external code generation and simplifies tasks such as documentation generation, code formatting, linting, and IDE-based tooling. Experimental evidence and test results show that the library can reliably handle core Protobuf features, including nested messages, enums, services, and custom options, thereby laying the groundwork for a fully Swift-based workflow in gRPC and Protocol Buffers development.

Keywords

Swift, Protocol Buffers, lexical analysis, parsing, dynamic serialization

References

Aho A. V. et al. Lexical analysis //Compilers: Principles, Techniques, and Tools. 2nd ed. Pearson Education: Inc. – 2006. – С. 109-90.

Barik R. et al. Optimization of Swift Protocols //Proceedings of the ACM on Programming Languages. – 2019. – Т. 3. – №. OOPSLA. – С. 1-27.

Kish A. Proto Reflection Implementation For Dynamic Interaction With gRPC Services In High-load Systems //The American Journal Of Engineering And Technology. – 2024. – vol. 6. – №. 12 – pp. 84-91.

Kish A. The Future of Api Development: How Proto Reflection Transforms GRPC Interactions //International Journal of Scientific Research and Engineering Development. – 2025. – vol. 8. – №. 1 – pp. 406-411.

Nimpattanavong C. et al. Improving Data Transfer Efficiency for AIs in the DareFightingICE using gRPC //2023 8th International Conference on Business and Industrial Research (ICBIR). – IEEE, 2023. – pp. 286-290.

Pai T V., Aithal P. S. A systematic literature review of lexical analyzer implementation techniques in compiler design //International Journal of Applied Engineering and Management Letters (IJAEML). – 2020. – Т. 4. – №. 2. – С. 285-301.

Sangwai A. et al. Barricading System-System Communication using gRPC and Protocol Buffers //2023 5th Biennial International Conference on Nascent Technologies in Engineering (ICNTE). – IEEE, 2023. – С. 1-5.

Google. (2020). Protocol Buffers Documentation. Retrieved from https://developers.google.com/protocol-buffers

Swift-protoparser. Retrieved from https://github.com/truewebber/swift-protoparser

Article Statistics

Downloads

Download data is not yet available.

Copyright License

Download Citations

How to Cite

Kish Aleksei. (2025). Swift Proto Parser: A Framework for Native Tools for Protocol Buffers. The American Journal of Applied Sciences, 7(03), 13–19. https://doi.org/10.37547/tajas/Volume07Issue03-03