Thread Closed 
(-) precedence
12-23-2022, 07:54 AM
Post: #64
RE: (-) precedence
(12-23-2022 12:02 AM)Albert Chan Wrote:  Hi, ijabbott

If we pickup tokens in reversed order, "precedence inversion" / "not making sense" does not happen.

How to distinguish subtraction from negation
Quote:If you can subtract, do it; if you can’t, then take it as a negation. Subtraction has priority.

Scanning backward, it will handle (op +/-) without issue.

2^-3^4
2^-(3^4)
2^(-(3^4))

2*-3/4
(2*-3)/4
(2*(-3))/4

Scanning backward is not necessary for this. Whether a + or - is unary or binary is unambiguously clear from when it is found during parsing: if it is found while looking for a subexpression, then it is unary, else it is binary. And what follows is parsed as an additive term in both cases.
Visit this user's website Find all posts by this user
Thread Closed 


Messages In This Thread
(-) precedence - jhallen - 12-08-2022, 01:10 PM
RE: (-) precedence - Thomas Okken - 12-08-2022, 01:30 PM
RE: (-) precedence - jhallen - 12-08-2022, 01:47 PM
RE: (-) precedence - Matt Agajanian - 12-08-2022, 08:25 PM
RE: (-) precedence - Eddie W. Shore - 12-08-2022, 01:41 PM
RE: (-) precedence - Maximilian Hohmann - 12-08-2022, 02:21 PM
RE: (-) precedence - KeithB - 12-08-2022, 02:38 PM
RE: (-) precedence - Maximilian Hohmann - 12-08-2022, 03:38 PM
RE: (-) precedence - KeithB - 12-08-2022, 04:01 PM
RE: (-) precedence - Thomas Okken - 12-08-2022, 05:43 PM
RE: (-) precedence - jhallen - 12-08-2022, 06:27 PM
RE: (-) precedence - Thomas Okken - 12-08-2022, 06:39 PM
RE: (-) precedence - jhallen - 12-08-2022, 06:49 PM
RE: (-) precedence - Albert Chan - 12-08-2022, 07:18 PM
RE: (-) precedence - Thomas Okken - 12-08-2022, 07:04 PM
RE: (-) precedence - Albert Chan - 12-08-2022, 07:33 PM
RE: (-) precedence - Massimo Gnerucci - 12-08-2022, 07:56 PM
RE: (-) precedence - Thomas Okken - 12-08-2022, 09:21 PM
RE: (-) precedence - Matt Agajanian - 12-08-2022, 09:47 PM
RE: (-) precedence - Matt Agajanian - 12-08-2022, 10:02 PM
RE: (-) precedence - Albert Chan - 12-09-2022, 04:02 PM
RE: (-) precedence - Thomas Okken - 12-08-2022, 10:23 PM
RE: (-) precedence - Matt Agajanian - 12-09-2022, 12:15 AM
RE: (-) precedence - KeithB - 12-09-2022, 02:52 PM
RE: (-) precedence - mfleming - 12-10-2022, 01:51 AM
RE: (-) precedence - rprosperi - 12-10-2022, 03:42 AM
RE: (-) precedence - Maximilian Hohmann - 12-10-2022, 04:18 PM
RE: (-) precedence - John Keith - 12-10-2022, 04:38 PM
RE: (-) precedence - toml_12953 - 12-10-2022, 05:57 PM
RE: (-) precedence - rprosperi - 12-10-2022, 06:56 PM
RE: (-) precedence - mfleming - 12-10-2022, 11:23 PM
RE: (-) precedence - John Keith - 12-10-2022, 10:22 PM
RE: (-) precedence - EdS2 - 12-11-2022, 08:29 AM
RE: (-) precedence - Maximilian Hohmann - 12-11-2022, 10:38 AM
RE: (-) precedence - mfleming - 12-11-2022, 01:27 PM
RE: (-) precedence - FLISZT - 12-12-2022, 04:37 PM
RE: (-) precedence - mfleming - 12-12-2022, 10:13 PM
RE: (-) precedence - FLISZT - 12-12-2022, 11:56 PM
RE: (-) precedence - David Hayden - 12-13-2022, 03:59 PM
RE: (-) precedence - Thomas Okken - 12-13-2022, 06:12 PM
RE: (-) precedence - Matt Agajanian - 12-19-2022, 08:56 PM
RE: (-) precedence - David Hayden - 12-21-2022, 12:08 AM
RE: (-) precedence - Albert Chan - 12-18-2022, 03:47 PM
RE: (-) precedence - KeithB - 12-19-2022, 06:28 PM
RE: (-) precedence - ijabbott - 12-13-2022, 07:37 PM
RE: (-) precedence - jhallen - 12-20-2022, 04:09 AM
RE: (-) precedence - Matt Agajanian - 12-20-2022, 05:48 AM
RE: (-) precedence - Matt Agajanian - 12-20-2022, 06:07 AM
RE: (-) precedence - Dan C - 12-21-2022, 06:29 PM
RE: (-) precedence - Matt Agajanian - 12-21-2022, 10:28 PM
RE: (-) precedence - Joe Horn - 12-22-2022, 03:03 AM
RE: (-) precedence - Matt Agajanian - 12-22-2022, 07:47 AM
RE: (-) precedence - Sukiari - 12-22-2022, 03:31 AM
RE: (-) precedence - Thomas Okken - 12-22-2022, 05:43 AM
RE: (-) precedence - Sukiari - 12-22-2022, 03:16 PM
RE: (-) precedence - Maximilian Hohmann - 12-22-2022, 05:46 PM
RE: (-) precedence - Sukiari - 12-23-2022, 05:11 AM
RE: (-) precedence - Thomas Okken - 12-23-2022, 07:16 AM
RE: (-) precedence - Sukiari - 12-25-2022, 11:46 PM
RE: (-) precedence - ijabbott - 12-26-2022, 09:43 AM
RE: (-) precedence - Albert Chan - 12-22-2022, 06:05 PM
RE: (-) precedence - Joe Horn - 12-22-2022, 01:25 PM
RE: (-) precedence - ijabbott - 12-22-2022, 09:17 PM
RE: (-) precedence - Albert Chan - 12-23-2022, 12:02 AM
RE: (-) precedence - Matt Agajanian - 12-23-2022, 06:04 AM
RE: (-) precedence - Albert Chan - 12-23-2022, 08:04 AM
RE: (-) precedence - toml_12953 - 12-23-2022, 10:32 AM
RE: (-) precedence - Thomas Okken - 12-23-2022, 03:54 PM
RE: (-) precedence - ijabbott - 12-23-2022, 07:40 PM
RE: (-) precedence - Thomas Okken - 12-23-2022 07:54 AM
RE: (-) precedence - rprosperi - 12-26-2022, 01:21 AM
RE: (-) precedence - Thomas Okken - 12-26-2022, 06:11 AM
RE: (-) precedence - Sukiari - 12-26-2022, 03:25 PM
RE: (-) precedence - Thomas Okken - 12-26-2022, 06:10 PM
RE: (-) precedence - Eddie W. Shore - 12-26-2022, 03:55 PM
RE: (-) precedence - Sukiari - 12-26-2022, 08:50 PM
RE: (-) precedence - klesl - 12-26-2022, 09:42 PM
RE: (-) precedence - ijabbott - 12-26-2022, 10:54 PM
RE: (-) precedence - Eddie W. Shore - 12-27-2022, 01:33 AM
RE: (-) precedence - Matt Agajanian - 12-26-2022, 08:23 PM
RE: (-) precedence - Thomas Okken - 12-26-2022, 09:00 PM
RE: (-) precedence - Thomas Okken - 12-26-2022, 09:10 PM
RE: (-) precedence - rprosperi - 12-26-2022, 10:00 PM
RE: (-) precedence - FLISZT - 12-27-2022, 02:36 AM



User(s) browsing this thread: 7 Guest(s)