3 LiterateExpression Structures
Lexp-structures.rkt contains the base structures for building literate experssions.
(provide(all-defined-out))
3.1 Base DataTypes
3.1.1 Racket lexp DataType
A Literate Expression is expressed as a data structure with two fields.
a perl structure p.
a function f that returns a string for the Racket regex.
(struct lexp (p f))
The base datatype of struct deviates from Racket VerbalExpressions which used a simple matching of string with symbol. The reason for changing the data-type to struct is to ultimately facilitate four possible parsing scenarios:
lexp -> perl
lexp -> description
perl -> lexp
perl -> description
3.1.2 The Racket perl structure
The purpose of the perl structure is to provide a neutral data type that can be exported for use in the implementation of LiterateExpressions in other languages - e.g. the perl structures could be exported as JSON or XML for use by other programmers interested in implementing LiterateExpressions...or VerbalExpressons for that matter.
A string symb that provides a consistent name for the Regex token
A string perlx that is the Perl Language Character for the element
a string description that contains the Perl language description.
(define-struct perl (symb perlx description))
It is important to recognize that although the Perl Language description may reference features that are not available and that the Regex element may not be available in a particular language - inculding Racket. These are included becuase the wider goal of LiterateExpressions is to provide a platform for implementaiton in other languages, and they may have different features.