On 7-Apr-07, at 12:21 PM, William Tanksley, Jr wrote: > Definitely. All production concatenative languages have such a feature > already: any word in the form "\<[0-9]+\>" is treated as a number. > Adding new types of literals is not a severe difficulty in general. > > Forth behaves as follows: it first grabs a blank-delimited string, > tries to look it up in the dictionary; if defined, it executes it. > Otherwise it tries to interpret it as a number; if valid, it pushes > the value on the stack. Otherwise it errors out.
Factor behaves in a similar way as well, except it tries parsing the token as a number before looking it up in the dictionary. Here is the key word (http://factorcode.org/repos/Factor/core/syntax/parser.factor): : scan-word ( -- word/number/f ) scan dup [ dup string>number [ ] [ search ] ?if ] when ; Slava ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
