aiken-lang 1.0.22-alpha

The Aiken compiler
Documentation
---
source: crates/aiken-lang/src/parser.rs
description: "Code:\n\nfn foo_1() {\n  let a = bar\n  (40)\n}\n\nfn foo_2() {\n  let a = bar\n  {40}\n}\n\nfn foo_3() {\n  let a = (40+2)\n}\n\nfn foo_4() {\n  let a = bar(42)\n  (a + 14) * 42\n}\n"
---
Module {
    name: "",
    docs: [],
    type_info: (),
    definitions: [
        Fn(
            Function {
                arguments: [],
                body: Sequence {
                    location: 15..32,
                    expressions: [
                        Assignment {
                            location: 15..26,
                            value: Var {
                                location: 23..26,
                                name: "bar",
                            },
                            pattern: Var {
                                location: 19..20,
                                name: "a",
                            },
                            kind: Let,
                            annotation: None,
                        },
                        UInt {
                            location: 30..32,
                            value: "40",
                            base: Decimal {
                                numeric_underscore: false,
                            },
                        },
                    ],
                },
                doc: None,
                location: 0..10,
                name: "foo_1",
                public: false,
                return_annotation: None,
                return_type: (),
                end_position: 34,
                can_error: true,
            },
        ),
        Fn(
            Function {
                arguments: [],
                body: Sequence {
                    location: 52..69,
                    expressions: [
                        Assignment {
                            location: 52..63,
                            value: Var {
                                location: 60..63,
                                name: "bar",
                            },
                            pattern: Var {
                                location: 56..57,
                                name: "a",
                            },
                            kind: Let,
                            annotation: None,
                        },
                        UInt {
                            location: 67..69,
                            value: "40",
                            base: Decimal {
                                numeric_underscore: false,
                            },
                        },
                    ],
                },
                doc: None,
                location: 37..47,
                name: "foo_2",
                public: false,
                return_annotation: None,
                return_type: (),
                end_position: 71,
                can_error: true,
            },
        ),
        Fn(
            Function {
                arguments: [],
                body: Assignment {
                    location: 89..103,
                    value: BinOp {
                        location: 98..102,
                        name: AddInt,
                        left: UInt {
                            location: 98..100,
                            value: "40",
                            base: Decimal {
                                numeric_underscore: false,
                            },
                        },
                        right: UInt {
                            location: 101..102,
                            value: "2",
                            base: Decimal {
                                numeric_underscore: false,
                            },
                        },
                    },
                    pattern: Var {
                        location: 93..94,
                        name: "a",
                    },
                    kind: Let,
                    annotation: None,
                },
                doc: None,
                location: 74..84,
                name: "foo_3",
                public: false,
                return_annotation: None,
                return_type: (),
                end_position: 104,
                can_error: true,
            },
        ),
        Fn(
            Function {
                arguments: [],
                body: Sequence {
                    location: 122..153,
                    expressions: [
                        Assignment {
                            location: 122..137,
                            value: Call {
                                arguments: [
                                    CallArg {
                                        label: None,
                                        location: 134..136,
                                        value: UInt {
                                            location: 134..136,
                                            value: "42",
                                            base: Decimal {
                                                numeric_underscore: false,
                                            },
                                        },
                                    },
                                ],
                                fun: Var {
                                    location: 130..133,
                                    name: "bar",
                                },
                                location: 130..137,
                            },
                            pattern: Var {
                                location: 126..127,
                                name: "a",
                            },
                            kind: Let,
                            annotation: None,
                        },
                        BinOp {
                            location: 141..153,
                            name: MultInt,
                            left: BinOp {
                                location: 141..147,
                                name: AddInt,
                                left: Var {
                                    location: 141..142,
                                    name: "a",
                                },
                                right: UInt {
                                    location: 145..147,
                                    value: "14",
                                    base: Decimal {
                                        numeric_underscore: false,
                                    },
                                },
                            },
                            right: UInt {
                                location: 151..153,
                                value: "42",
                                base: Decimal {
                                    numeric_underscore: false,
                                },
                            },
                        },
                    ],
                },
                doc: None,
                location: 107..117,
                name: "foo_4",
                public: false,
                return_annotation: None,
                return_type: (),
                end_position: 154,
                can_error: true,
            },
        ),
    ],
    lines: LineNumbers {
        line_starts: [
            0,
            13,
            27,
            34,
            36,
            37,
            50,
            64,
            71,
            73,
            74,
            87,
            104,
            106,
            107,
            120,
            138,
            154,
            156,
        ],
        length: 156,
        last: Some(
            156,
        ),
    },
    kind: Validator,
}