#serialization #apple #parser #pkl #performance #format #statement

bin+lib pkl_fast

A library aiming to easily and efficiently work with Apple's PKL format

2 releases

0.1.1 Feb 11, 2024
0.1.0 Feb 11, 2024

#2 in #pkl

MIT license

9KB
246 lines

Pkl_fast

Overview

pkl_fast is a Rust library aiming to become an efficient tool for working with Apple's Pkl format. The library shall provide fast and reliable parsing and manipulation capabilities for Pkl files in Rust projects.

Note: This library is still in development. The lexer part is completed, and work on the parser has begun.

Features

  • Efficient lexer for tokenizing Pkl files (using the blazingly fast logos crate), using winnow parsing library instead as logos is too limited (no support for look-ahead in regex)
  • The parser is currently under development and is intended to return the Pkl file as statements. It will also provide warnings for non-recommended code practices and display errors as needed.
  • Designed for speed and reliability.

Todo List

  • Parsing basic values (e.g., int, float, boolean, string, datasize, duration)

  • Parsing objects declaration

  • Parsing Map, Set, List

  • Parsing Mapping, Listing

  • Parsing simple type annotations (Int, Float, UInt16, unknown, Any)

  • Parsing more complex type annotations (e.g., Listing<Type>, Mapping<Type, OtherType>) without type checking

  • Adding type checking

  • Parsing import/import\* statement (with optional as)

  • Parsing amends statement

  • Parsing extends statement

  • Parsing module statement

  • Parsing variable declaration statement (partially done)

  • Parsing class statement

  • Parsing function statement

  • Parsing @ModuleInfo/@Deprecated annotation

  • Parsing typealias annotation (partially done, need to support unions)

  • Parsing If/Else/Let/For/When statement

  • Parsing Arithmetic expressions

  • Parsing Function call expressions

  • Parsing InterpolatedString expressions

  • Generating a symbol table from the statements

How to implement in Rust ?

Here is a list of pkl's features that should be implemented in rust, but which are not obvious to implement.

None for the moment, but there will be for sure...

Contact

For questions, suggestions, or feedback, please reach out to me at yatsu.dev@gmail.com. Pull requests are appreciated, and issues are welcome too! Thank you for your interest in contributing to the project!

Dependencies

~1.5MB