@ 21ba553f2ac9aed7435e6a7744c2a33c37c9dec8 | history
// Package gov2lisp turns a decoded program back into Lisp source text.
package gov2lisp
import (
"strings"
"government/sexpr"
)
// Decompile prints one top-level form per line. The output is source in
// normal form: the printer's spelling, so 'x comes back as (quote x),
// 3.10 as 3.1, and comments are gone until notes carry them (Phase 7).
// Reading it gives exactly the forms that were decoded.
func Decompile(forms []sexpr.Value) string {
var b strings.Builder
for _, f := range forms {
b.WriteString(sexpr.Print(f))
b.WriteByte('\n')
}
return b.String()
}