Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Prefix/polish notation in Java

Name: Anonymous 2009-02-08 12:09

How do I do it?????????

Name: Anonymous 2009-02-09 7:35

>>12
Postfix sucks:
- Variable arguments are needlessly complicated
- Practically requires a stack-based implementation, so it's more difficult to optimize code on typical systems
- Common constructs ('if', 'loop') either need to be written backwards (unintuitive), or require extra syntactic sugar or special cases in the parser (inflexible)
- Determining whether a given token is a function call or variable requires either a lookup table or extra syntax
- Program errors that disrupt the stack are easy to make and difficult to diagnose

With prefix notation, the only syntax necessary is a statement delimiter. This is a more than acceptable tradeoff for the tremendous gain in language flexibility, parsing is dead simple, because the first token in any given expression will always be either a function or a subexpression that resolves to one, and following tokens until the closing delimiter are its arguments.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List