December 2021
Beginner
840 pages
47h 29m
English
A variant record is an aggregate data type that is a union of records (i.e., a union of structs); it can hold any one of a variety of records. Each constituent record type is called a variant of the union type. Variant records can also be inductive. Consider the idea that context-free grammars can be used to define data structures in addition to languages, which we explored in Chapter 5. A variant record is an effective building block for building a data structure defined with a context-free grammar because the variant record mirrors the EBNF definition of the data structure. We can use a linked list of integers in C to illustrate a variant record. Consider the following EBNF definition of a list:
The following ...
Read now
Unlock full access