ahmetozdemirrr / alanc

Compiler of A Programming Language
GNU General Public License v3.0
5 stars 2 forks source link

Resolving shift/reduce conflicts in Parser #19

Open ahmetozdemirrr opened 2 days ago

ahmetozdemirrr commented 2 days ago

In Parser there are some shift/reduce conflicts in conditional expressions, declaration and expression CFGs. These are expected to be resolved in this issue.

animeshjare26 commented 2 days ago

I've added the following enhancements to address the concerns raised:

Operator Precedence: Defined precedence rules to resolve conflicts between unary and binary operators. %right is used for operators like assignment and unary minus, while %left handles binary operators such as +, -, *, and /.

If/Else Handling: Implemented clear rules for if, elif, and else to avoid ambiguity in nested conditions, using explicit parts like ELIF_PART and ELSE_PART.

Augmented Assignment: Clarified the precedence for operators like += using %prec, ensuring correct interpretation of augmented assignments.

Let me know if you have any further questions or feedback!

ahmetozdemirrr commented 2 days ago

I guess you haven't added the additions you are talking about yet. If you have resolved these conflicts, please share them with us as a pull request. Otherwise, I'll add it as an issue when we have a problem, thank you.