bool
test_parsing (
(
α
β
)
 
to_string
, 
(
β
α
)
 
of_string
, 
β
 
s)
Generic function for testing that parsing and pretty-printing functions
are inverses of each other. We cannot simply check for:
to_string(of_string(s)) == sas the input string will typically have some stuff that will be thrown
away in its data representation types (think: white space). But instead
we perform this test with its normalized version i.e. with:
s_normalized = to_string(of_string(s))we check that: to_string(of_string(s_normalized)) == s_normalizedSo in a sense we check for the fixed point of the initial condition.
to_string
a function converting from this data type to string
of_string
a function converting from string to some data type
s
a string on which to test whether parsing and pretty printing
are inverses in the above sense.
returns
a boolean value indicating whether the test was successful

Comments

The browser you use is not supported by this application, probably because it lacks some critical features.
For a better experience, please consider using this application with a supported browser.