Choosing a way for a simple read-only read-once modify-easily small database

Hello,

I am bootstrapping an Air Traffic Control simulator to develop it in Ada. I am going to be re-doing my previous work in C of this project and need to be able to load from the database the waypoints, planes, airports, runways, etc. It should be easy to modify for quick iteration. The amounts of data is not enormous and I do not need blazingly fast speed.

A critical point for me is that the loader should be relatively simple. For example, this is the parser library for my previous project, which you can see has few and small files at lib/: ZenitDS/lzconf: Custom config file library - Codeberg.org

This is one database file which I had previously and give as an example:

The next example will have different structure and content but I hope that it is clear what I mean

# RESOURCE_DIRECTORY/GCCC/atc/atc.zc

[ include
	display.cxo graph/cxo.zc
	display.cts graph/cts.zc
	display.gca graph/gca.zc
	display.twr graph/twr.zc
	display.rwy graph/rwy.zc
	display.mva graph/mva.zc
	display.obs graph/obs.zc
	display.cac graph/cac.zc

	display.st.SCT graph/state/SECTOR.zc
	display.st.SCTH graph/state/SECTORH.zc

	display.sct.gcts graph/sector/gcts.zc
	display.sct.gcxo graph/sector/gcxo.zc
	display.sct.gclp_n graph/sector/gclp_n.zc
	display.sct.gclp_s graph/sector/gclp_s.zc
	display.sct.gcnb graph/sector/gcnb.zc
	display.sct.gcac graph/sector/gcac.zc

	display.terrain.tenerife graph/terrain/tenerife.zc
	display.terrain.lagomera graph/terrain/lagomera.zc
	display.terrain.elhierro graph/terrain/elhierro.zc
	display.terrain.fuerteventura graph/terrain/fuerteventura.zc
	display.terrain.grancanaria graph/terrain/grancanaria.zc
	display.terrain.lanzarote graph/terrain/lanzarote.zc
	display.terrain.lapalma graph/terrain/lapalma.zc

	env.cfg ../env/cfg.zc
	env.ways ../env/ways.zc
	env.freqs ../env/freq.zc
]

[ positions
	[ tnfs
		[ mode TRACON ]
		[ display
			cts
			st.SCT sct.gcxo sct.gclp_n sct.gclp_s sct.gcnb sct.gcac
			st.SCTH sct.gcts
			obs twr rwy mva
			terrain.tenerife
			terrain.lagomera
			terrain.elhierro
			terrain.fuerteventura
			terrain.grancanaria
			terrain.lanzarote
			terrain.lapalma
		]
		[ range 35. ]
		[ filter "005/240 010/160" ]
		[ rings "10|28 02 40 N 016 34 21 W" ]
		[ center "27 56 06.2 N 016 38 09.6 W" ]
		[ frequencies
			[ TNF_SOUTH_APP ]
			[ UNICOM ]
		]
		[ atis GCTS GCXO GCLP GCFV GCRR GCHI GCLA ]
		[ waypoint
			GDV HIE LPC TFN TFS LRO FTV LZR LTE
			ESOPA LUFIR QITTI FEMMA LULUG YELBE
			ICAFU YEQAY BOXCO ARACO REMGI ODEGI
			MOROD LUCSI XANOS KUTUR COSSE PELIN
			LOMAS
			TS506 TS559 TS568 TS710 TS717 TS721 TS726
			TS731 TS742 TS744 TS746 TS748 TS763 TS765
			TS767 TS769 TS901 TS971 TS972
		]
		[ runway "7" ]
		[ taxiway ]
	]

	[ tnfn
		[ mode TRACON ]
		[ display
			cxo
			st.SCT sct.gcts sct.gclp_n sct.gclp_s sct.gcnb sct.gcac
			st.SCTH sct.gcxo
			obs twr rwy mva
			terrain.tenerife
			terrain.lagomera
			terrain.elhierro
			terrain.fuerteventura
			terrain.grancanaria
			terrain.lanzarote
			terrain.lapalma
		]
		[ range 35. ]
		[ filter "005/100 010/150" ]
		[ rings "10|28 28 58 N 016 20 30 W" ]
		[ center "28 35 00 N 016 20 00 W" ]
		[ frequencies
			[ TNF_NORTH_APP ]
			[ UNICOM ]
		]
		[ atis GCXO GCTS GCLP GCFV GCRR GCHI GCLA ]
		[ waypoint
			GDV HIE LPC TFN TFS LRO FTV LZR LTE
			BUNIX BASUX CANDE TESEL
			ARTEM MOROD COSSE BOXCO
		]
		[ runway "30" ]
		[ taxiway ]
	]

	[ gca
		[ mode TRACON ]
		[ display
			gca
			st.SCT sct.gcts sct.gcxo sct.gcnb sct.gcac
			st.SCTH sct.gclp_n sct.gclp_s
			obs twr rwy mva
			terrain.tenerife
			terrain.lagomera
			terrain.elhierro
			terrain.fuerteventura
			terrain.grancanaria
			terrain.lanzarote
			terrain.lapalma
		]
		[ range 55. ]
		[ filter "005/240 010/160" ]
		[ rings "5|27 42 28.1 N 015 21 34.7 W" ]

		[ center "28 00 00 N 015 23 12 W" ]
		[ frequencies
			[ GCA_APP ]
			[ UNICOM ]
		]
		[ atis GCLP GCTS GCXO GCFV GCRR GCHI GCLA ]
		[ waypoint
			GDV HIE LPC TFN TFS LRO FTV LZR LTE
			LOMAS ODEGI REMGI URQUI
			ECKOS ISLET DRANO THAIS NERVO ARTEM COLON 
			LARYS RASEP KOPUD MOVAS QITTI
			ENETA LALTO TOMOS FALPU TISCA ADOKI CANDE
			MATUD SARWO ZUCRU KONDA PELIN
			DELAP ISORU TODKO LACOR LIFBI COCTO BAFEM
			XIBUS NIDES BETAN CANIS LORPO FAYTA
			LP405 LP406 LP415
		]
		[ runway "3L" ]
		[ taxiway ]
	]

	[ gclp_gnd
		[ mode ASDEX ]
		[ display ]
		[ range 1. ]
		[ filter "000/000 000/000" ]
		[ rings "5|27 55 55 N 015 23 12 W" ]

		[ center "27 55 55 N 015 23 12 W" ]
		[ frequencies
			[ GCA_TWR GCA_GND ]
			[ UNICOM ]
		]
		[ waypoint ]
		[ runway "3L" "3R" "21R" "21L"]
		[ taxiway
			R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13
			Z1 Z2 Z3 Z4 Z5 Z6 Z7 Z8 Z9 Z10 Z11 Z12 Z13
		]
	]

	[ tnf
		[ mode TRACON ]
		[ display
			cts cxo
			st.SCT sct.gclp_n sct.gclp_s sct.gcnb sct.gcac
			st.SCTH sct.gcxo sct.gcts
			obs twr rwy mva
			terrain.tenerife
			terrain.lagomera
			terrain.elhierro
			terrain.fuerteventura
			terrain.grancanaria
			terrain.lanzarote
			terrain.lapalma
		]
		[ range 50. ]
		[ filter "005/240 010/160" ]
		[ rings "10|28 02 40 N 016 34 21 W" ]
		[ center "28 15 00.0 N 016 38 09.6 W" ]
		[ frequencies
			[ TNF_NORTH_APP TNF_SOUTH_APP ]
			[ UNICOM ]
		]
		[ atis GCXO GCTS GCLP GCFV GCRR GCHI GCLA ]
		[ waypoint
			GDV HIE LPC TFN TFS LRO FTV LZR LTE
			ESOPA LUFIR QITTI FEMMA LULUG YELBE
			ICAFU YEQAY BOXCO ARACO REMGI ODEGI
			MOROD LUCSI XANOS KUTUR COSSE PELIN
			LOMAS

			BUNIX BASUX CANDE TESEL ARTEM

			TS506 TS559 TS568 TS710 TS717 TS721 TS726
			TS731 TS742 TS744 TS746 TS748 TS763 TS765
			TS767 TS769 TS901 TS971 TS972
		]
		[ taxiway ]
		[ runway "7" "30" ]
	]

	[ cac
		[ mode TRACON ]
		[ display
			cac
			st.SCT sct.gclp_n sct.gclp_s sct.gcnb sct.gcac sct.gcxo sct.gcts
			st.SCTH sct.gcac
			obs twr rwy mva
			terrain.tenerife
			terrain.lagomera
			terrain.elhierro
			terrain.fuerteventura
			terrain.grancanaria
			terrain.lanzarote
			terrain.lapalma
		]
		[ range 70. ]
		[ filter "005/240 010/160" ]
		[ rings "10|28 42 00.0 N 013 49 00 W" ]
		[ center "28 42 00.0 N 013 49 00 W" ]
		[ frequencies
			[ CCA_APP$GCAC ]
			[ UNICOM ]
		]
		[ atis GCRR GCFV GCXO GCTS GCLP GCHI GCLA ]
		[ waypoint
			GDV HIE LPC TFN TFS LRO FTV LZR LTE
			TENDA TOPSU DEMEX LIRBU SIRPU ADOVO KEMEV IBOLO
			UMOTO BAPAL DURCO ALEDU ASTAM GOLFY ROCAZ NIRPO
			BUSAP DIBIB POKAB ELNAN LINDE SOMOB LUNOB TADEK MAPED
			RULOB KOSIB BETAN LORPO RASEP KOPUD CANIS YOLAS
			KUCOS GAMVA ALUGO GINAS DEVLA LARYS TICKE
			RR401 RR402 RR450
			FV621 FV622 FV623 FV672 FV731 FV732
		]
		[ runway "1" "3" ]
		[ taxiway ]
	]
]

One possibility would be to use JSON, however that would be very similar to what I had and believe I can do better. I think probably a bit of typing would help both in the loading and in the understanding of the database by the developer (me), which often got confused, specially when thinking if the variable is feet, meters or inches :confused:

This latter issue may be fixed by inserting sub-types to categories. Which would also allow to use different units for the same entry.

e.g. .Altitude.Feet and .Altitude.Meters

This is a sketch of what I have right now.

% Description       Gran Canarias Approach Tracon
% Space_Indentation 2

% Type_Definitions Coordinate Frequency
% Type_Definitions Icao_Airport Runway Atc_Tag
% Type_Definitions Scalar Percent Degrees Altitude.Feet Miles

% Include generic.zc

Configuration
  Coordinate_Center .Coordinate 28 30 00 N 15 00 00 W
  North_Degrees     .Degrees 355
  Atc
    Clearance
      Minimum_Altitude    .Altitude.Feet 1000
    Area
      Transition_Altitude .Altitude.Feet 6500
  Planes
    Go_Around_Probability .Percent 5

Frequencies
  %
    Identifier      .Frequency_Identifier UNICOM
    Atc_Tag         .Atc_Tag U
    Frequency       .Frequency_Number 121.5
  %
    Identifier      .Frequency_Identifier CCA_CTR
    Atc_Tag         .Atc_Tag C
    Frequency       .Frequency_Number 126.5
    All_Boundaries  .Boolean True
  %
    Identifier  .Frequency_Identifier TNF_S_GND
    Atc_Tag     .Atc_Tag G
    Frequency   .Frequency_Number 121.9
  %
    Identifier  .Frequency_Identifier TNF_S_TWR
    Atc_Tag     .Atc_Tag ST
    Frequency   .Frequency_Number 119.0
    Boundaries
      %
        Bottom_Altitude .Altitude.Feet 0
        Top_Altitude    .Altitude.Feet 3000
        Bounds
          % .Coordinate 28 06 59 N 016 34 21 W
          % .Coordinate 28 06 54 N 016 35 16 W
          % .Coordinate 28 06 41 N 016 36 09 W
          % .Coordinate 28 06 19 N 016 36 58 W
          % .Coordinate 28 05 43 N 016 37 49 W
          % .Coordinate 28 05 06 N 016 38 24 W
          % .Coordinate 28 04 23 N 016 38 50 W
          % .Coordinate 28 03 36 N 016 39 07 W
          % .Coordinate 28 02 40 N 016 39 14 W
          % .Coordinate 28 01 51 N 016 39 09 W
          % .Coordinate 28 01 05 N 016 38 54 W
          % .Coordinate 28 00 21 N 016 38 29 W
          % .Coordinate 27 59 37 N 016 37 48 W
          % .Coordinate 27 59 06 N 016 37 06 W
          % .Coordinate 27 58 42 N 016 36 17 W
          % .Coordinate 27 58 27 N 016 35 25 W
          % .Coordinate 27 58 21 N 016 34 21 W
          % .Coordinate 27 58 27 N 016 33 17 W
          % .Coordinate 27 58 42 N 016 32 25 W
          % .Coordinate 27 59 06 N 016 31 36 W
          % .Coordinate 27 59 37 N 016 30 54 W
          % .Coordinate 28 00 21 N 016 30 13 W
          % .Coordinate 28 01 05 N 016 29 48 W
          % .Coordinate 28 01 51 N 016 29 33 W
          % .Coordinate 28 02 40 N 016 29 28 W
          % .Coordinate 28 03 36 N 016 29 35 W
          % .Coordinate 28 04 23 N 016 29 52 W
          % .Coordinate 28 05 06 N 016 30 18 W
          % .Coordinate 28 05 43 N 016 30 53 W
          % .Coordinate 28 06 19 N 016 31 44 W
          % .Coordinate 28 06 41 N 016 32 33 W
          % .Coordinate 28 06 54 N 016 33 26 W
      %
        Top_Altitude    .Altitude.Feet 1000
        Bottom_Altitude .Altitude.Feet 0
        Bounds
          % .Coordinate 28 02 34 N 016 47 55 W
          % .Coordinate 28 01 31 N 016 47 53 W
          % .Coordinate 28 00 24 N 016 47 42 W
          % .Coordinate 27 59 18 N 016 47 24 W
          % .Coordinate 27 57 53 N 016 46 49 W
          % .Coordinate 27 55 55 N 016 45 35 W
          % .Coordinate 27 54 10 N 016 43 57 W
          % .Coordinate 27 52 44 N 016 41 58 W
          % .Coordinate 27 51 39 N 016 39 44 W
          % .Coordinate 27 50 57 N 016 37 18 W
          % .Coordinate 27 50 46 N 016 36 03 W
          % .Coordinate 27 50 40 N 016 34 21 W
          % .Coordinate 27 50 46 N 016 32 39 W
          % .Coordinate 27 50 58 N 016 31 23 W
          % .Coordinate 27 51 39 N 016 28 57 W
          % .Coordinate 27 52 45 N 016 26 43 W
          % .Coordinate 27 54 11 N 016 24 45 W
          % .Coordinate 27 55 19 N 016 23 37 W
          % .Coordinate 27 56 14 N 016 22 53 W
          % .Coordinate 27 58 15 N 016 21 43 W
          % .Coordinate 28 00 25 N 016 21 00 W
          % .Coordinate 28 01 32 N 016 20 49 W
          % .Coordinate 28 02 40 N 016 20 45 W
          % .Coordinate 28 03 47 N 016 20 49 W
          % .Coordinate 28 04 55 N 016 20 60 W
          % .Coordinate 28 06 44 N 016 21 33 W
          % .Coordinate 28 08 27 N 016 22 26 W
          % .Coordinate 28 10 01 N 016 23 36 W

Airports
  %
    ICAO_Identifier        .Icao_Airport_Identifier GCTS
    Spoken_Name            .Spoken_Name             Tenerife South
    Geometry
      Center   .Coordinate    28 02 40 N 016 34 21 W
      Altitude .Altitude.Feet 210
      Frequencies
        %
          Short_Identifier .String TWR
          Full_Identifier  .Frequency_Identifier TNF_S_TWR
        %
          Short_Identifier .String GND
          Full_Identifier  .Frequency_Identifier TNF_S_GND
      Runways
        %
          Identifier .Runway            7
          Active     .Boolean           True
          Threshold  .Coordinate        28 02 21.14 N 016 35 15.50 W
          End        .Coordinate        28 02 59.10 N 016 33 26.43 W
          Approaches
            Type           .Approach_Type        ILS
            Instrument_Fix .Waypoint_Identifier  TS710
            Procedures
              %
                Intercept_Altitude .Altitude.Feet 2500
                Route              .Route         XANOS,3000|,$220 TS710
              %
                Intercept_Altitude .Altitude.Feet 2500
                Route              .Route         KUTUR,3000| TS717,3000| TS710
            Go_Around_Procedure
              % alt 3000
              % hold KUTUR 320 right

    Charts
      Departures
        %
          Identifier .Departure_Identifier BIMBO1W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        24000
          Route      .Route                TS506 COSSE,FL120| LUCSI KASAS BIMBO,FL200|
        %
          Identifier .Departure_Identifier COSSE1W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        7000
          Route      .Route                TS506 COSSE,|FL090
        %
          Identifier .Departure_Identifier DESUM1W
          Runway     .Runway               7
          Altitude   .Altitude.FligthLevel 240
          Route      .Route                TS506 PELIN,FL100| GDV,FL150| SARAY DESUM
        %
          Identifier .Departure_Identifier GDV1P
          Runway     .Runway               7
          Altitude   .Altitude.FlightLevel 240
          Route      .Route                TS506 PELIN,FL100| GDV,FL150|
        %
          Identifier .Departure_Identifier HIE1W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        7000
          Route      .Route                TS506 TS971,4000|,$210 TS972,FL070|,$230 HIE
        %
          Identifier .Departure_Identifier KASAS1W
          Runway     .Runway               7
          Altitude   .Altitude.FlightLevel 240
          Route      .Route                TS506 COSSE,FL120| LUCSI KASAS
        %
          Identifier .Departure_Identifier KONBA1W
          Runway     .Runway               7
          Altitude   .Altitude.FlightLevel 240
          Route      .Route                TS506 COSSE,FL120| LUCSI KASAS KONBA,FL200|
        %
          Identifier .Departure_Identifier KORAL1P
          Runway     .Runway               7
          Altitude   .Altitude.FlightLevel 240
          Route      .Route                TS506 PELIN,FL100| GDV,FL150| KORAL,FL150|
        %
          Identifier .Departure_Identifier MOROD1W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        7000
          Route      .Route                TS506 TS971,4000|,$210 TS972,5000|5000,$230 TS901,5000|5000 MOROD,|FL070
        %
          Identifier .Departure_Identifier ODEGI2W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        7000
          Route      .Route                TS506 QITTI,|FL070 MATUD ODEGI,FL200|
        %
          Identifier .Departure_Identifier PELIN2W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        9000
          Route      .Route                TS506 PELIN,|FL090
        %
          Identifier .Departure_Identifier RASEP1W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        24000
          Route      .Route                TS506 PELIN,FL100| GDV,FL150| RASEP
        %
          Identifier .Departure_Identifier REMGI2W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        7000
          Route      .Route                TS506 QITTI,|FL070 REMGI,FL150|
        %
          Identifier .Departure_Identifier VASTO1W
          Runway     .Runway               7
          Altitude   .Altitude.Feet        24000
          Route      .Route                TS506 PELIN,FL100| GDV,FL150| SARAY VASTO,FL200|

      Arrivals
        %
          Identifier .Departure_Identifier ESOPA2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                ESOPA LUFIR,$250,293<250 TS568 QITTI TS559,FL090| FEMMA,252<250 LULUG,6000|FL100,220$220,251<220 TS748,4000|FL070 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier HIE2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                HIE,FL150| BOXCO,$250 YEQAY,FL110|,125>250 ICAFU,FL080|FL100,220$220,129>220 TS769,6000|FL070 TS767,4000| TS765,3000| TS763 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier KONBA2X
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                KONBA,FL200| BRICK ARACO BOXCO,$250 YEQAY,FL110|,125>250 ICAFU,FL080|FL100,220$220,129>220 TS769,6000|FL070 TS767,4000| TS765,3000| TS763 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier LOMAS2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                LOMAS QITTI,$250 TS559,FL090| FEMMA,252<250 LULUG,6000|FL100,220$220,251<220 TS748,4000|FL070 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier LORPO2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                LORPO LPC,293<250 QITTI,$250 TS559,FL090| FEMMA,252<250 LULUG,6000|FL100,220$220,251<220 TS748,4000|FL070 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier ODEGI2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                ODEGI,FL110| FEMMA,$250 LULUG,6000|FL100,220$220,251<220 TS748,4000|FL070 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier ORTIS2X
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                ORTIS,FL110| BRICK ARACO BOXCO,$250 YEQAY,FL110|,125>250 ICAFU,FL080|FL100,220$220,129>220 TS769,6000|FL070 TS767,4000| TS765,3000| TS763 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier REMGI2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                REMGI,FL100| LOMAS QITTI,$250 TS559,FL090| FEMMA,252<250 LULUG,6000|FL100,220$220,251<220 TS748,4000|FL070 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier RUSIK2K
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                RUSIK CANIS LPC,293<250 QITTI,$250 TS559,FL090| FEMMA,252<250 LULUG,6000|FL100,220$220 TS748,4000|FL070 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier TERTO2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                TERTO,FL100| CANIS LPC,293<250 QITTI,250$250 TS559,FL090| FEMMA,252<250 LULUG,6000|FL100,220$220 TS748,4000|FL070 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier URQUI2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                URQUI,FL100| LULUG,6000|FL100,220$220 TS748,4000|FL070 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier VIZON2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                VIZON TS748,4000|FL070,$220 TS746,3000| TS744 TS742 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier YEQAY2Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                YEQAY,FL110|,125>250 ICAFU,FL080|FL100,220$220,129>220 TS769,6000|FL070 TS767,4000| TS765,3000| TS763 TS731 TS726 TS721 XANOS,3000|,072>220
        %
          Identifier .Departure_Identifier YELBE1Y
          Runway     .Runway               7
          Altitude   .Altitude.Feet        3000
          Route      .Route                YELBE,091>220 TS731,3000|,$220 TS726 TS721 XANOS,3000|,072>220

Waypoints
  %
    Identifier  .Waypoint_Identifier GDV
    Spoken_Name .Spoken_Name         Gran Canaria
    Kind        .Waypoint_Kind       VOR
    Coordinate  .Coordinate          28 04 37.5 N 015 25 44.4 W
  %
    Identifier  .Waypoint_Identifier HIE
    Spoken_Name .Spoken_Name         El Hierro
    Kind        .Waypoint_Kind       VOR
    Coordinate  .Coordinate          27 48 58.2 N 017 53 11.0 W
  %
    Identifier  .Waypoint_Identifier LPC
    Spoken_Name .Spoken_Name         Gran Canarias South
    Kind        .Waypoint_Kind       VOR IAF
    Coordinate  .Coordinate          27 49 42.7 N 015 25 56.1 W
  %
    Identifier  .Waypoint_Identifier TFN
    Spoken_Name .Spoken_Name         Tenerife North
    Kind        .Waypoint_Kind       VOR IAF
    Coordinate  .Coordinate          28 32 12.9 N 016 16 07.2 W
  %
    Identifier  .Waypoint_Identifier TFS
    Spoken_Name .Spoken_Name         Tenerife South
    Kind        .Waypoint_Kind       VOR IAF
    Coordinate  .Coordinate          28 00 08.8 N 016 41 15.0 W
  %
    Identifier  .Waypoint_Identifier LRO
    Spoken_Name .Spoken_Name         Los Rodeos
    Kind        .Waypoint_Kind       VOR
    Coordinate  .Coordinate          28 29 05.7 N 016 21 05.6 W
  %
    Identifier  .Waypoint_Identifier FTV
    Spoken_Name .Spoken_Name         Fuerte Ventura
    Kind        .Waypoint_Kind       VOR
    Coordinate  .Coordinate          28 25 51 N 013 51 52 W
  %
    Identifier  .Waypoint_Identifier LZR
    Spoken_Name .Spoken_Name         Lanzarote
    Kind        .Waypoint_Kind       VOR
    Coordinate  .Coordinate          29 09 58 N 013 30 39 W
  %
    Identifier  .Waypoint_Identifier LTE
    Spoken_Name .Spoken_Name         Lanzarote Airport
    Kind        .Waypoint_Kind       VOR IAF
    Coordinate  .Coordinate          28 56 53 N 013 36 05 W
  %
    Identifier  .Waypoint_Identifier BABNA
    Spoken_Name .Spoken_Name         Babna
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          30 00 43 N 010 10 15 W
  %
    Identifier  .Waypoint_Identifier VEDOD
    Spoken_Name .Spoken_Name         Vedod
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          30 30 21 N 012 22 24 W
  %
    Identifier  .Waypoint_Identifier SULAM
    Spoken_Name .Spoken_Name         Sulam
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          30 54 57 N 013 14 54 W
  %
    Identifier  .Waypoint_Identifier MITLA
    Spoken_Name .Spoken_Name         Mitla
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          31 18 30 N 014 04 56 W
  %
    Identifier  .Waypoint_Identifier SONSO
    Spoken_Name .Spoken_Name         Sonso
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          30 00 44 N 012 06 07 W
  %
    Identifier  .Waypoint_Identifier ADOKI
    Spoken_Name .Spoken_Name         Adoki
    Kind        .Waypoint_Kind       FIX IAF
    Coordinate  .Coordinate          27 43 55.9 N 015 25 46.4 W
  %
    Identifier  .Waypoint_Identifier ADOVO
    Spoken_Name .Spoken_Name         Adovo
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          28 34 05 N 013 47 42 W
  %
    Identifier  .Waypoint_Identifier ALEDU
    Spoken_Name .Spoken_Name         Aledu
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          28 54 07.0 N 013 20 41.1 W
  %
    Identifier  .Waypoint_Identifier ALUGO
    Spoken_Name .Spoken_Name         Alugo
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          29 28 08 N 013 00 38 W
  %
    Identifier  .Waypoint_Identifier ARACO
    Spoken_Name .Spoken_Name         Araco
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          28 25 57.1 N 017 27 08.4 W
  %
    Identifier  .Waypoint_Identifier ARTEM
    Spoken_Name .Spoken_Name         Artem
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          28 24 33 N 016 02 03 W
  %
    Identifier  .Waypoint_Identifier ASTAM
    Spoken_Name .Spoken_Name         Astam
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          28 58 52.3 N 013 18 52.8 W
  %
    Identifier  .Waypoint_Identifier BAFEM
    Spoken_Name .Spoken_Name         Bafem
    Kind        .Waypoint_Kind       FIX IAF
    Coordinate  .Coordinate          27 49 51.6 N 015 09 09.0 W
  %
    Identifier  .Waypoint_Identifier BAMKU
    Spoken_Name .Spoken_Name         Bamku
    Kind        .Waypoint_Kind       FIX
    Coordinate  .Coordinate          28 22 46.3 N 013 43 44.6 W
  %
    Identifier  .Waypoint_Identifier BAPAL
    Spoken_Name .Spoken_Name         Bapal
    Kind        .Waypoint_Kind       FIX IAF
    Coordinate  .Coordinate          28 41 16.5 N 013 25 45.5 W

Positions
  %
    Name .String tnfs
    Scope
      Range .Miles 35
      Rings
        Spacing .Miles 10
        Center  .Coordinate 28 02 40 N 016 34 21 W
      Filter
        Primary
          Minimum .Altitude.Feet 1000
          Maximum .Altitude.Feet 16000
        Secondary
          Minimum .Altitude.Feet 500
          Maximum .Altitude.Feet 24000
      Frequencies
        Slot_0
          Frequency .Frequency_Identifier TNF_SOUTH_APP
        Slot_1
          Frequency .Frequency_Identifier UNICOM
      Atis
        % .ICAO_Airport GCTS
        % .ICAO_Airport GCXO
        % .ICAO_Airport GCLP
        % .ICAO_Airport GCFV
        % .ICAO_Airport GCRR
        % .ICAO_Airport GCHI
        % .ICAO_Airport GCLA

Thanks in advance
–zen

For reference, here goes a gameplay example of the C version

I would recommend against JSON, in general. (Or, at least, knowing/understanding the drawbacks.)
Even XML is/can-be better, because of the DTD (Data Type Definition), where you can enforce some constraints and validation, whereas JSON forces this into the application proper.

If this is just a simulator, you can just ā€œmumbleā€ it: use ā€˜units’ and simply ā€œdon’t careā€ about the physicality. (That is to say, ā€˜feet’ and ā€˜yards’ and ā€˜meters’ don’t really matter in any non-physical system, only when reified [made actual] does it matter.)

XML seems like a good format, however I am afraid that it is a bit overkill and difficult to modify in general. The database is to be modified frequently during the development of scenarios.

While that is true for most games, here I am using real-world units from airplanes, because I am simulating the real airplane physics to some approximation.

P.D. Going to add a link of an example of the game for reference on what I’m building

Is it a language or database (persistent data). These are not same. You claim the latter but present the former.

A lot bad, never-ever-use things spawn from confusion: JSON, XML, TOML. The list is almost infinite and keeps growing.

What I am looking for is to store some structured data in a format that can be easily modified. Not sure what you mean by the language :thinking:

My first example is very similar to JSON, it has strings, numbers and arrays. It was mostly an experiment for making a homegrown configuration format.

The second example shows a similar YAML-like format if you will in which each variable if you will is annotated with a type, with the idea that having the type explicitly aids in understanding the field’s value.

On

A lot bad, never-ever-use things spawn from confusion: JSON, XML, TOML. The list is almost infinite and keeps growing.

What would you propose in this case?

I mean, if it’s all [essentially] internal, you can just (1) write a record of the appropriate data, (2) instantiate the proper structure from Ada.Containers, and (3) dump-to/read-from disk. (This is not guarenteed to be portable, even across different versions of the compiler; but simply storing data presents no real issue.)

Sure, but configuration and your data are two different things. You could, for example, store your config data in an INI file and your data in a CSV spreadsheet-dump.

I think it really depends on the what that you’re doing, and this includes the how it will be used; just like that ā€˜what’ and ā€˜usage’ inform the selection of datastructures and algorithms.

Ok, this gave me an idea :light_bulb: . Not quite the internal that you meant but…

For the initial stages have the database hardcoded and then outsource to a loader further in the development so that the users can develop, use and share their scenarios more easily.

The idea is that the users can just make scenarios without too much knowledge of the simulator and its internals.

The case is not yet stated:

  • Language. I want a human readable input of complex data with validation and semantic checks. Configurations usually need that and programming languages obviously too.
  • Persistency. I want my data kept between program runs, maybe transfer data.

You might have both like SQL + DB and, of course, Ada + object library.

My guess is that you do not need a language just persistent objects. The later can become complex if you want to maintain versions of. But in the simplest form it is stream to serialize into a file.

One step up is a storage of interdependent objects randomly updated, sort of small OO database. For the backend a full database could be used, or a singe-file database (SQLite) or just a file. You would serialize into blobs with metadata for indexing. You can find a sample in Simple Components.

I just need to store the different scenarios. I have been using plain text files that encode structured data because it was easy to modify. My intent is to reduce the amount of mistakes made when passing real-world numbers to the files and make editing the files faster.

I guess by this definition what I want is a ā€œLanguageā€ then.

I use xml with xsds. DTD are old and not as expressive as xsd.

JSON is coming with schema as well https://json-schema.org, although I have not used it myself.

I see the advantage with XML and a XSD to be

  • less surprises in parsing - you know what type of data you get
    • of course that data may not be what you think - but tighter XSD usually helps
  • easy to read - if properly designed.
    • I use tags for grouping and attributes for data. makes it much more readable
  • XML-ada makes it ok to parse. and validate.
  • I don’t write to XML from programs, just read
  • Edit by notepad++ and xml/json plugin makes it easier
  • XML and JSON are recognized by others if you are a team.
    • not perfekt, but better than home-brewed parsers for every project.
    • However sometimes the home-brew format is more fitting the project, but might be harder for new developers/configurators/users to understand.
  • XML has comments - JSON does not

Then write a language. It is simpler than appears. At least simpler than XML et at. All validation work is needed anyway, but you do not have to deal with horrific syntax. The samples you posted are for an elementary descendant parser, not even recursive.

If you want to build a domain specific language for your configuration, good old Tcl might be a solution.

Maybe you could try GitHub - simonjwright/tcladashell: Ada binding to Tcl/Tk. Note, the copyright is GPL 2.0 + GMGPL Ā· GitHub

Write your configuration in Tcl, run it in the Tcl interpreter embedded into Ada and get the data structures out.

tcladashell/demos/freq.adb at 4c588c12752a81819b9e0cf186ffb765d86637c0 Ā· simonjwright/tcladashell Ā· GitHub accesses tcl hash table from Ada (without running an interpreter at all)

You can either read the variables from the interpreter after your config file has been ā€œrunā€

or you can define your own commands available to the Tcl interpreter. (or both)

tcladashell/demos/timer_app.adb at 4c588c12752a81819b9e0cf186ffb765d86637c0 Ā· simonjwright/tcladashell Ā· GitHub demonstrates how to plug Ada subprograms that will be callable from the Tcl program. Those could fill in your data structures as you need, so for example both Frequencies, Identifier and Atc_Tag from your new examples could be commands written in Ada.

Or embed Lua, which was designed as a configuration language.

What for Tcl? I always wonder this readiness to drop Ada by any opportunity however questionable.

Parsing the text presented is almost trivial.

P.S. One could of course make it more palatable, e.g. by using properly spelled dimensioned values:

355°
6500 feet 1.9812 km 2.094130E-13 ly :grinning:
121.5 kHz
74° 0' 21.6" W

and removing meaningless dots and percent signs.

Thanks everyone for your inputs. :slight_smile:

XML would maybe be an interesting choice for the interoperability as you mention. I am not sure however that I am convinced by the whole syntax, which is a bit cumbersome to write by hand in my opinion.

In this case however I think it may be a bit overkill for what I am trying to do for the time being.

Yup, I think too that is much better

Using tags as structure and attributes as data makes it fairly ok. Here a sample with 4 levels, describing a workflows - sequences.

A group of sequences, some folded ones, one unfolded where it has steps, and steps has alternatives, and alternatives may have alternative steps. But readability is up to the beholder I guess.

What I like with the XSDs is that

  • ā€˜type’ is an enumerated. can only hold the values in the xsd.
  • next must be 12 decimal digits
  • receive and send are enums too
  • subsystemidentity must be positive between 80 and 99
  • comment in max 80 chars
  • the tags I expect is a fixed set in a defined order

Everything else does not validate. I just print the validators error text, and in the next run, I expect the error to be fixed. If it passes the validation, then I don’t need extra validation. In the general case perhaps you do. But this is for me and my colleagues only, and it works very well.