r/ProgrammingLanguages • u/HaskellLisp_green • Jun 24 '26
Help Documentation and testing
Hello, I finished my bachelor thesis that is development of Lisp interpreter. It is implemented in C(GNU99).
I need some tips on how to organize documentation(formal specification) of my custom Lisp dialect and the way to test interpreter.
Currently my documentation is couple of org files. Index is the root file with links to particular notes: data types, special forms, primitive functions.
File "data-types.org" provide enumeration of existing types and their properties.
File "special-forms.org" and "primitive-functions.org" provide similar enumerations. For each special form or primitive function I define arguments number, arguments type and description.
(Beside these documentation entries there are notes on architecture, building, interning, e.t.c)
So I consider documentation as the source of truth. If actual behavior doesn't match documentation, it's a bug. For example, car expects exactly 1 argument of list type. So it should fail and raise error message if type is different.
My question is how to define full test suite that covers whole interpreter? I have several ideas. I have already implemented python script that requires particular build and tests. Each test is made of script and associated expected output. I think for each component there should be positive and negative tests. But how can I say that given set of test cases for given primitive function, special form, e.t.c. is enough?
Also what are good practices of writing programming language documentation?
View all comments
Show parent comment
1
u/Big-Rub9545 Jun 25 '26
Seems to capture this idea with some more detail as well. Thanks for sharing!