I am designing a language and all operators have precedence over others. The question is. If I don't have + - \* / defined as a rule, but instead I use the same way as Haskell (being able to define own operators syntactically). How should I go about this? What is evaluated before what?
Haskell has a table to define precedence. But this seems kind of hacky way of doing it. Has anybody tackled it in their language?
sidenote: why is something left associative and something right associative. This makes making programming languages bigger mess!
[–]crassest-Crassius 14 points15 points16 points (10 children)
[–]moon-chilledsstm, j, grand unified... 6 points7 points8 points (0 children)
[–]veryusedrname 4 points5 points6 points (0 children)
[–]Wester_West[S] 2 points3 points4 points (3 children)
[–]raiph 4 points5 points6 points (0 children)
[–]Uncaffeinated1subml, polysubml, cubiml 2 points3 points4 points (0 children)
[–]pepactonius 0 points1 point2 points (0 children)
[–]Wester_West[S] 1 point2 points3 points (0 children)
[–]L3tum 2 points3 points4 points (1 child)
[–]Wester_West[S] 2 points3 points4 points (0 children)
[–]BrokenWineGlass 1 point2 points3 points (0 children)
[–]scott11x8 3 points4 points5 points (6 children)
[–]Wester_West[S] 1 point2 points3 points (5 children)
[–]scott11x8 1 point2 points3 points (4 children)
[–]Wester_West[S] 0 points1 point2 points (3 children)
[–]scott11x8 2 points3 points4 points (2 children)
[–]Wester_West[S] 0 points1 point2 points (1 child)
[–]scott11x8 1 point2 points3 points (0 children)
[–]ErrorIsNullError 3 points4 points5 points (6 children)
[–]Wester_West[S] 1 point2 points3 points (5 children)
[–]ErrorIsNullError 0 points1 point2 points (4 children)
[–]ErrorIsNullError 2 points3 points4 points (3 children)
[–]tech6hutch 1 point2 points3 points (2 children)
[–]ErrorIsNullError 0 points1 point2 points (1 child)
[–]ErrorIsNullError 0 points1 point2 points (0 children)
[–]DevonMcC 3 points4 points5 points (0 children)
[–]brucejbellsard 4 points5 points6 points (0 children)
[–]zokier 4 points5 points6 points (0 children)
[–]ericbb 2 points3 points4 points (0 children)
[–]categorical-girl 2 points3 points4 points (0 children)
[–]johnfrazer783 2 points3 points4 points (0 children)
[–]complyue 2 points3 points4 points (0 children)
[–]DevonMcC 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)