-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pretty Printer #3
Comments
There is much prior art in s-expression pretty printing, though most of it focuses specifically on rules for Lisp-like languages. If that's your target here, you probably want to implement (something like) the X3J13 pretty-printing style or mimic the Guile or Racket pretty printers. In summary, the former, tightly-braced style makes a good deal more sense as a starting point, but adding behaviours depending on symbols would be useful. Symbols should also always be tightly-braced before and after, as dangling parens or loose parens tend to look bad in the context of Lisps, so:
|
Let me propose a few rules. Classifying ValuesFirst, we classify every value as either code or data in an implicit manner.
Secondly, we classify the depth of each list as such:
The hard part after this is using this information to know when to indent an break lines... |
Hi there 👋 I'm a few years late to the party, but was wondering if you intended to merge that |
Currently, all output is through display and printed on a single line. It'd be good to have a pretty printer that nicely formats the output using the following rules:
with indentation advanced beyond the brace.
is then indented beyond the brace to line up with the following arguments.
Condensed format with tight bracing
Sparse formatting with loose bracing
The text was updated successfully, but these errors were encountered: