Re: Operator precedence different from C/C#/C++

53 views
Skip to first unread message

piter....@gmail.com

unread,
Oct 17, 2012, 4:05:29 AM10/17/12
to ssh...@googlegroups.com
This is something that should be surely addressed.

 Please sent your changes, or even better make your branch on https://github.com/PetroProtsyk/SSharp and push your changes.

On Tuesday, October 16, 2012 2:58:23 PM UTC+2, Andrew wrote:
I notice that the operator precedence is different from C/C#/C++.  I have modified the precedence to match.  I would like to suggest the following modified precedence in both the grammar generator and the parser.  I have added "*=", "/=", "<<=", ">>=" and the ternary operator, ":?".  I would like to also suggest that these operators be added to SSharp.  I can send my (likely incomplete) code if necessary.

SymbolTerminal.RegisterPunctuation("("")""[""]""{""}"","";");
SymbolTerminal.RegisterOperators(1, "=""+=""-=""*=""/="":=""<<="">>=");
SymbolTerminal.RegisterOperators(2, "?"":");
SymbolTerminal.RegisterOperators(3, "||");
SymbolTerminal.RegisterOperators(4, "&&");
SymbolTerminal.RegisterOperators(5, "|");
SymbolTerminal.RegisterOperators(6, "&");
SymbolTerminal.RegisterOperators(7, "==""!=");
SymbolTerminal.RegisterOperators(8, ">""<"">=""<=");
SymbolTerminal.RegisterOperators(9, ">>""<<");
SymbolTerminal.RegisterOperators(10, "is");
SymbolTerminal.RegisterOperators(11, "+""-");
SymbolTerminal.RegisterOperators(12, "*""/""%");
SymbolTerminal.RegisterOperators(13, Associativity.Right, "^");
SymbolTerminal.RegisterOperators(14, "~""!""$""++""--");
SymbolTerminal.RegisterOperators(15, ".");

Reply all
Reply to author
Forward
0 new messages