Skip to content

Compile without unnecessary parentheses #27

Open
andreas-web wants to merge 6 commits into
masterfrom
compile
Open

Compile without unnecessary parentheses #27
andreas-web wants to merge 6 commits into
masterfrom
compile

Conversation

@andreas-web
Copy link
Copy Markdown
Collaborator

This pull request adds functionality to JessieCode that compiles an AST without unnecessary parentheses.

To achieve this, the following changes are made:

  • New function jc.minParentheses
  • New command 'minParentheses' in jc._genericParse
  • New parameter jcMinParens in the jc.compile function; its default value is false. This does not change anything in existing calls!
  • In jc.compile:
    • Add parenthesis-avoidance functionality
    • Recursive sub-function compile. jc.compile is no longer recursive itself. This eliminates the need to always "pass on" the parameters js and jcMinParens

Additionally:

  • _genericParse now receives its attributes as an object (for future compatibility)
  • Some documentation improvements
  • Some JessieCode tests

No changes have been made to the existing functionality. The new functionality is only used when calling board.jc.minParentheses or board.jc.compile(..., ..., true).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant