Hacker News new | ask | show | jobs
by lifthrasiir 869 days ago
Obviously that doesn't generalize for opcodes with 0, 1, 3 or more input operands. As a concrete example, consider a fused multiply-add operation: `rd = fma rs1, rs2, rs3` is consistent, but how would you convert it to an infix notation?
2 comments

  rd = rs1 * rs2 + rs3
It's no different from parsing if/then/else. Provided one assignment maps to one opcode, it's unambiguous.
pre-fix is the finest notation for many reasons. So, Intel syntax makes more sense than ATT syntax.

Even C functions are pre-fix. [function_name arg1, arg2 ...] If schools were teaching pre-fix, we would be in better position to appreciate Intel syntax.

Higher maths uses pre-fix, for example: y=f(x) unfortenately, above line is not pure prefix... = y f(x) would be pure pre-fix.

  x++
is a postfix kind-of function

  a ? b : c
is ternary infix

Edit: arguably

  /* comment! */
is a function that takes an unquoted string. It's a no-op function so the compiler removes it at compile time (giggle)