Skip to content

Latest commit

 

History

History
164 lines (138 loc) · 7.34 KB

DEVELOPMENT.md

File metadata and controls

164 lines (138 loc) · 7.34 KB

👩🏻‍💻 psll-lang development

Notes for developers.


General

Run the checks on the code with:

pip install -Uq flake8 mypy black
black --preview .
flake8 .
mypy .

or with pre-commit:

pip install -Uq pre-commit
pre-commit run --all-files

Install psll in an editable mode:

pip install -e .

ToDo's

This is not a real-purpose language. In this section the 'optimisation' refers to obtaining nicer-looking and more compact pyramids, not not efficient code.

  • ?? Arrays / Linked lists
    • Improve array implementation
    • range keyword
      • add testing thereof
    • len keyword
  • nil keyword
    • Make it more robustly than (arg 999)
    • ?? Allow compiler to insert defs into preamble
  • Prettify the intermediate representation
  • ?? *( ... ) construct probs no
  • ?? Tree rendering
    • ?? Have a look at (optionally!) using anytree package for visualisation
    • ?? Ascii art to LaTeX
  • ?? Make PsllSyntaxError class do more
    • ?? Backtrace
    • ?? Or, I guess, rip it out and make it a normal SyntaxError
  • Protect set and maybe some other keywords from accidentally writing something like (set (x (set y 1)) (# line)). def is already protected like that, so why not set.
  • ++ and -- keywords (aka increment and decrement?)
  • Expanders shouldn't mutate nodes!
    • @functional decorator? Is that a thing?
  • Make string expansion balanced binary
    • ? should this be a compiler option...
  • ? allow only letters and numbers in variable names
  • ? Actually throw an error if bracket is found in an array, or is this somehow, sometimes desired? After all, braces are not allowed in variable names.
  • Add more sorting algorithms to examples (because they're fun to code.) Pancake sort?
    • ? Add something to help with prefix and suffix?
  • Allow one to write the empty pyramid keyword explicitly as the underscore, such that ( (a) (b) ) can also be written as (_ (a) (b) ), just for completeness.
  • Add section about array expansions to this README
  • Comments between the pyramids (using inverted trees...?)
    • Check whether it would even work... (it would!!!)
    • Make sure they don't bloat the code...? (don't appear on the right)
    • Make sure they appear roughly in the right place...?
  • Put all the trees under a single root??
  • Add Ewok-village optimisation (<- this is a big one. should probably make it version 2.0.0)

More on the 'project management' front:

  • ?? Easier to use installation. Maybe a makefile which makes a symlink in the correct place...
    • ?? pip install psll ...
    • ??? brew tap. I mean, why not. Its not polluting the core with needless software if its just a tap...
    • finish the download-pyra option in psll cli
  • Make sure migration to travis.com (from travis.org) went fine (whenever that happens)
    • ?? deprecate travis?? github actions seem to work better for small projects like this
  • Better testing
    • Add testing psll bash script to tests
      • ?? And somehow coverage bashcov
      • Use hypothesis in testing ?
      • Test for correct example output
      • ?? Test code optimisation
    • Improve test coverage
      • Make the coverage count only the tests for that file
      • tree_repr coverage
      • psll coverage
      • Test asymmetric children in tree_repr
    • ? Move testing to makefile
      • Make sure it works with travis
    • Move to pytest
    • Test cli
  • Add esolang wiki page. I think I deserve one now.
  • Add psll to tio...?
  • Add more thorough mypy checks

Done's

Bullet points get moved here from the above section when they get finished. (It's nice to keep a history of past ideas and goals)

  • Compiler optimisation takes a long time
  • !! Add memoisation to build_tree
  • More compiler optimisations
    • !! Subtree packing <- !!! (work on this next!)
    • Packing with null-tree snakes kindof
    • Better (non-greedy?) optimisation
    • Variable name optimisation
      • Automatic shortening
      • Packing into the upper parts of the triangles
  • ?? Pre-compile code optimisations Not sure what that would be though, tbh.
    • Move string expansion to pre-proc
    • Move binary bracket expansion to pre-proc
    • Move null-trees to pre-proc <- (work on this next, because it's broken...)
  • Add option to force a node with one child to make it a right child
    • ?? Add None (or None-like) values to the abstract syntax tree representation
    • ?? Interpret _ as not-a-tree
    • Therefore optimise chr in string expansion
    • Also add this to the snake optimiser
  • Redo tree / string parsing with paired delimiter matching
    • ?? Have a look at pyparsing (QuotedString, nestedExpr) <- No, because I want to keep this as vanilla python as possible.
  • ?? Syntactic sugar
    • Simpler writing of strings
      • Add support for escape characters
    • Simpler writing of nested nil pyramids
    • def keyword
    • ?? _ keyword
    • Implicit expansion of out command, such that one can write (out "j: " j " | k: " k newline) and it gets expanded into a pile of out commands
    • Expansion of + and * commands too
      • Right and left-associative expansion
  • Add mention of the Sigbovik paper to README
  • ?? Move the command line code from psll.py to a bash script (<- not done in favour of abandoning the bash script alltogether)
  • Configure flake8 and fight with it for a while
  • ?? Same for mypy
  • psll.sh is a mess, therefore (amongst others) run.sh is a mess

Bugs

  • [, ] and " Pyramid-Scheme keywords are not working at all at the moment (they ought to be typed as \[, \] and \") (It's ok. They're really nto that useful, but it would be nice if they did actually work too.)
  • arrays example is putting in rouge commas into int literals
  • () pop the scope stack
  • (_) breaks the compiler (Why would someone decide to write this though...?) Ok, so this is not happening anymore, but I don't know why so I'm leaving it here to investigate.
  • Bug in greedy optimisation for source code with one major tree
  • Intermediate representation is ugly since the multiple spaces are gone. This is not really a bug, but would be nice to change.
  • def replacer sometimes adds an extra pyramid
  • ? should ( (x) (y z) ) and ( x (y z) ) have the same intermediate ast?
  • The order of operations in right-associative expansions is reversed in the last bracket!!

Bugs no more

  • Strings do not support escape characters (And maybe they never will! Ha! They're just sugar anyway...) (Fine...)
  • compact option breaks when Nth triangle is wider than all the 1..N-1s.
  • compact option does nothing
  • Asymmetric children cause issues in tree_repr in add_one_child
  • " command doesn't work (it gets recognized as a psll string)
  • Multiple spaces in strings get squashed to one because the intermediate representation is oblivious of context and just re's the entire source.