Does your DSL little language need operator precedence?

(utcc.utoronto.ca)

9 points | by ingve 2 days ago ago

3 comments

  • recursivedoubts 40 minutes ago

    hyperscript has some operator precedence, but within a given general precedence level you have to explicitly parenthesize if you use different operators:

    https://github.com/bigskysoftware/_hyperscript/blob/06f9078a...

    https://github.com/bigskysoftware/_hyperscript/blob/06f9078a...

    this eliminates most practical precendence questions

    NB: one thing that may strike people as strange is that the parse methods are on the parse elements themselves, I like to localize everything about a parse element in one place

  • bitwize 2 hours ago

    Not if it's s-expression-based! (laughs in smug lisp weenie)

    • aleph_minus_one an hour ago

      Or, if the programming language uses infix binary operators:

      Not if the programming language has evaluation order from left to right, e.g.

      2+3*4

      is evaluated as

      (2+3)*4.

      For example J uses this kind of evaluation.