Thread Closed 
(-) precedence
12-08-2022, 05:43 PM
Post: #9
RE: (-) precedence
I think some of the confusion may stem from early textbooks that demonstrated parsers that treated negative numbers as self-contained entities. So, -2 was treated as the number -2, rather than the number 2 to which a unary minus is applied.

If you use the latter approach, and then optimize for negative numbers by transforming "number with unary minus applied" to "negative number" after parsing, then everything is fine, but if you use the former approach, you end up with unary minus having highest priority -- and then you have to make sure that unary minus applied to anything that isn't a number literal behaves the same way, and then you end up with -2^2 being something different than 0-2^2, and that makes mathematicians sad.
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: 1 Guest(s)