davidcallanan / py-myopl-code

Interpreter for the BASIC language written in Python 3
MIT License
469 stars 326 forks source link

support multiplication with parentheses #33

Open kajvans opened 2 years ago

kajvans commented 2 years ago

how do i make it that 5(2+3) works as 5(2+3) and (2+3)5 as (2+3)5 so that if a number is directly connected to a parentheses it multiplies with the end value of the parentheses

foxypiratecove37350 commented 2 months ago

You can try to implement this grammar rule for the term:

term        : factor ((MUL|DIV) factor)*
            : factor LPAREN expr RPAREN