Configuration file symbol references solution

Skip to end of metadata
Go to start of metadata

Most data file formats require very little in terms of symbol table management. Indeed this problem only requires a list or hash table. As you read in the list of site specs:

make a HashMap called sites or whatever that maps:

mainSiteContext object 1
demoSiteContext object 2
meditationSiteContext object 3

When you see the family spec's sites definition:

You can test sites.get("main") and sites.get("meditation") to see if they exist. If not, flag an error.

In terms of implementation, you would see the following defs:

After the site specs, you would parse the family spec and check the references:

Note the use of a validating semantic predicate to test whether the ID is a valid site spec.

In summary: you need a HashMap and a bit of code to save the site specs and a bit of code to reference the HashMap.

Labels: