chom-parser / chom

Multi-target parser generator written in Rust.
0 stars 0 forks source link

Built-in `option` type. #1

Open timothee-haudebourg opened 3 years ago

timothee-haudebourg commented 3 years ago

Define a standard option type that translates into the target's native option type.

type expr = 
    | let: 'let' IDENT <option <annotation>> '=' <expr> 'in' <expr>

type annotation = ':' <type-expr>

In rust that would translate into:

enum Expr {
    Let(Ident, Option<Annotation>, Box<Expr>, Box<Expr>)
}