From 46e786db9d1b48b8fbc3502e36f093b755f3e09f Mon Sep 17 00:00:00 2001 From: kartofen Date: Tue, 26 Aug 2025 01:17:10 +0300 Subject: grammar for the grammar and lexing and parsing of a new language lbp --- demos/sample-files/lbp-code.lbp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 demos/sample-files/lbp-code.lbp (limited to 'demos/sample-files/lbp-code.lbp') diff --git a/demos/sample-files/lbp-code.lbp b/demos/sample-files/lbp-code.lbp new file mode 100644 index 0000000..df5bdcc --- /dev/null +++ b/demos/sample-files/lbp-code.lbp @@ -0,0 +1,40 @@ +inbounds/int-function(low, high, val) { + > val low, < val high. +}, + +:downlink_fmt/enum { + (17 |_, :EXTENDED_SQUITTER); + (18 |_, :NON_TRANSPONDER). +}, + +:type_code/enum { + (inbounds 1 4 |_, :AIRCRAFT_IDEN); + (inbounds 5 8 |_, :SURFACE_POS); + (inbounds 9 18 |_, :AIR_POS); + (inbounds 20 22 |_, ---); + (19 |_, ---); + (28 |_, ---); + (29 |_, ---); + (31 |_, ---). +}, + +:aircraft_iden/struct { +-. +}, + +:message/struct { + DF/enum(:downlinkfmt) |5, + CA/enum(:capabilities) |3, + ICAO/int-big |24, + TC/enum(:type_code) |5, + + ((TC :type_code:AIRCRAFT_IDEN, aircraft_iden/struct(:aircraft_iden)); + (TC :type_code:SURFACE_POS, surface_pos/struct { + POS |1, + - |_. + }); + (TC :type_code:AIR_POS, air_pos/struct(:air_pos)) + ) |51, + + CRC |24. +}. -- cgit v1.2.3