A computer-implemented method of generating a hardware description for configuring a digital electronic circuit to parse input data against an LL (1) grammar that defines a data format, the input data comprising a sequence of input tokens, the method comprising:
- providing a digitally stored graph representing a recursive transition network, RTN, based on the rules of the LL (1) grammar, and
- generating the hardware description in a hardware description language or as a netlist based on the RTN,
- wherein the RTN comprises one or more networks including a first embedded network that is embedded within itself and/or at least one other network of the RTN,
- wherein each of the one or more networks comprises a plurality of vertices and a plurality of directed edges connected between vertices of the network, the plurality of vertices including a start vertex and an end vertex, each directed edge connected between a respective source vertex and destination vertex of the network, wherein the plurality of directed edges of the one or more networks comprises a plurality of input-consuming edges and a plurality of non-input-consuming edges,
- wherein each input-consuming edge represents a transition between its source vertex and its destination vertex conditional on a current input token of the input data matching an input-consumption condition associated with the input-consuming edge, parsing of the input data advancing to a next input token of the input data with the transition,
- wherein each network within which the first embedded network is embedded comprises at least one first-embedded-network-calling edge and corresponding first-embedded-network-returning edge, which are non-input-consuming edges,
- wherein, for each first-embedded-network-calling edge and corresponding first-embedded-network-returning edge, the source vertex of the first-embedded-network-calling edge and destination vertex of the first-embedded-network-returning edge are vertices of a network within which the first embedded network is embedded, the destination vertex of the first-embedded-network-calling edge is the start vertex of the first embedded network, and the source vertex of the first-embedded-network-returning edge is the end vertex of the first embedded network,
- wherein generating the hardware description comprises implementing an input buffer in the hardware description to store a sequence of input tokens of the input data, the input buffer configured to provide an input token of the sequence of input tokens as output from the input buffer, wherein the input buffer is further configured to sequentially advance through the sequence of input tokens by, on a clock tick, providing a next input token as output from the input buffer,
- wherein generating the hardware description further comprises implementing a memory in the hardware description, the memory configured to store a value and provide the stored value as output from the memory,
- wherein generating the hardware description comprises further implementing circuitry in the hardware description for the edges and vertices of the RTN,
- wherein the implemented circuitry for each vertex is electrically connected to the implemented circuitry for each edge that is connected to the vertex in the RTN, the implemented circuitry for each vertex configured to output a logical high to circuitry for all outgoing directed edges of that vertex if circuitry for an incoming directed edge of that vertex provides a logical high,
- wherein the implemented circuitry for each input-consuming edge comprises a register with associated logic configured to compare an input token provided as output from the input buffer with the input-consumption condition associated with that input-consuming edge, the register with associated logic configured to, if the implemented circuitry for the source vertex of the input-consuming edge provides a logical high and the input token provided as output from the input buffer satisfies the input-consumption condition of the input-consuming edge, provide a logical high to circuitry for the destination vertex of the input-consuming edge on a next clock tick, the input buffer advancing to a next input token and providing the next input token as output from the input buffer on said next clock tick,
- wherein the implemented circuitry for each non-input-consuming edge comprises a coupling between circuitry for the source vertex of the non-input-consuming edge and circuitry for the destination vertex of the non-input-consuming edge,
- wherein the implemented circuitry for each first-embedded-network-calling edge further comprises logic to, in response to one or more calling-edge conditions associated with that edge all being satisfied, provide a logical high to the implemented circuitry for the destination vertex of that edge and store a value in the memory, the value indicative of the corresponding first-embedded-network-returning edge, the one or more calling-edge conditions associated with that edge including a requirement that the implemented circuitry for the source vertex of that edge provides a logical high,
- wherein the implemented circuitry for each first-embedded-network-returning edge further comprises logic to, in response to a plurality of returning-edge conditions associated with that edge all being satisfied, provide a logical high to the implemented circuitry for the destination vertex of that edge, the plurality of returning-edge conditions associated with that edge including:
- a requirement that the implemented circuitry for the source vertex of that edge provides a logical high and a requirement that the output from the memory is a value indicative of that edge.