Presentation Language Tool
Find a file
Damian Poddebniak c5babc3e32
Update README.md
2023-12-22 00:01:06 +01:00
assets docs: Add Usage section and example file. 2022-12-21 23:12:43 +01:00
src Initial commit. 2022-12-21 22:49:50 +01:00
.gitignore Initial commit. 2022-12-21 22:49:50 +01:00
Cargo.lock Initial commit. 2022-12-21 22:49:50 +01:00
Cargo.toml Initial commit. 2022-12-21 22:49:50 +01:00
LICENSE-APACHE chore: Add a README.md. 2022-12-21 22:55:17 +01:00
LICENSE-MIT chore: Add a README.md. 2022-12-21 22:55:17 +01:00
README.md Update README.md 2023-12-22 00:01:06 +01:00

Presentation Language Tool

A simple tool to parse the TLS/MLS presentation language for research and learning purposes.

Usage

Currently, this tool generates a dependency graph of all structs and enums defined in a given <file> and outputs a graph in either GML or GV format.

plt <file> [gml|gv]

You can try this out by running ...

cargo run -- assets/draft-ietf-mls-protocol.tls

... and using a GML viewer such as yEd. (Don't forget to apply an auto-layout.)

Warning

This tool is not thoroughly tested and might produce invalid GML/GV output. Use at your own risk!

Example

The following definition ...

struct {    
    CredentialType credential_type;    
    select (Credential.credential_type) {    
        case basic:    
            opaque identity<V>;    
    
        case x509:    
            Certificate chain<V>;    
    };    
} Credential;

... is parsed into ...

Struct(
    Struct {
        name: "Credential",
        items: [
            Field(
                Field {
                    type: "CredentialType",
                    name: "credential_type",
                    range: None,
                    optional: false,
                    default: None,
                },
            ),
            Select(
                Select {
                    over: "Credential.credential_type",
                    cases: [
                        Case {
                            left: "basic",
                            right: Fields(
                                [
                                    Field {
                                        type: "opaque",
                                        name: "identity",
                                        range: Some(
                                            Variable,
                                        ),
                                        optional: false,
                                        default: None,
                                    },
                                ],
                            ),
                        },
// ...
                    ],
                },
            ),
        ],
    },
)

License

Licensed under either of ...

... at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.