visma icon indicating copy to clipboard operation
visma copied to clipboard

Following a specific io syntax

Open 8hantanu opened this issue 5 years ago • 1 comments

To do:

  • Set a fixed syntax so there is no ambiguity while giving input.
  • Update the wiki by adding a page for input syntax and rules under User Manual section.
  • Output string (from the tokensToString() method) must also follow this syntax as it can be used again in an input.
  • Changes must be made in io/tokenize.py and io/checks.py accordingly.

Some examples:

  • Giving input as sin x is not allowed. The operand must always be contained in brackets like sin(x).
  • Should x^2y be interpretted as (x^2)*y or x^(2y) ?
  • Coefficient must be given before variables i.e 2xy is accepted xy2 is not.
  • Also use * when multiplying with expressions i.e. 2*(x+y) and (x+y)*(x-y) instead of 2(x+y) and (x+y)(x-y).
  • Always use a number before decimal point. Use 0.1 instead of .1 #113

You can list any examples of ambiguous inputs(or any changes if required to the current syntax) in the comments below. Note: Some of the above examples might not have been implemented yet. Any examples can be suggested which might be helpful when implementing them in future.

8hantanu avatar Mar 10 '19 09:03 8hantanu

These are Input forms I think VisMa should have.

- Spaces inside the input Expression are allowed but any space between the Trigonometric, Logarithmic, Exponential & hyperbolic functions are not allowed ( like: Si n(x) ).

- Any Trigonometric, Logarithmic, Exponential & hyperbolic functions must have at least 1 closing & 1 opening Bracket which contain the function's expression like: sin(x+4)

- Any Power must have at least a variable or a constant, and if it has more than one, it should be put between 2 Brackets. like: e^x ... e^(x+3) and should use ( ^ ) not ( ** ).

- Upper and lower cases are allowed.

- Constants or Variables which are positive shouldn't have ( + ) prefix for them, while negative should have a prefix ( - ) sign like: +X is not allowed.

- 1X or -1X will be directly changed into X & -X respectively.

- Equal sign should have at least one variable or constant on each side of it.

Whenever I found any other ambiguous input syntax I will add it in here.

Alii-Khaled avatar Apr 05 '19 22:04 Alii-Khaled