Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #20724
| From | mhx@iae.nl (Marcel Hendrix) |
|---|---|
| Subject | Re: Difficulty with Brad Rodriguez' screenful |
| Newsgroups | comp.lang.forth |
| Message-ID | <05170318008434@frunobulax.edu> (permalink) |
| Date | 2013-03-17 00:18 +0200 |
| References | <8ea2fd45-14b0-45ba-b49d-e3144b9f06ab@googlegroups.com> |
| Organization | Wanadoo |
Eduardo Costa <edu500ac@gmail.com> writes Re: Difficulty with Brad Rodriguez' screenful [..] > The program still does not work for Vfx Forth, and iForth. It makes iForth > crash, and gives wrong answers in the case of Vfx Forth. You're still doing "R> drop" in a colon definition for something you didn't put there yourself. [..] > Below you will find the listing of the new program. I hope you > can make suggestions for Vfx Forth and iForth. I also hope that > the author of iForth enters the discussion and makes his own > suggestions. I reformatted your program to make it readable for me. Just a personal style/taste issue, unformat it if you want. The idea is to inline the phrases ( <bf nbf> and | ) that want to do "R> drop". Once inlined, "R> drop" becomes "EXIT" which is portable. FORTH> S" my cat chases your dog" parsex Cat example: matched ok FORTH> S" my cat that bites your dog chases the ball" parsex Cat example: matched ok FORTH> S" my cat chases your bogeyman" parsex Cat example: failed ok -marcel -- --------------------- ANEW -rodriguez2 0 VALUE yn 0 VALUE /text CREATE text #124 CHARS ALLOT : >text ( c-addr u -- ) TO /text text /text CMOVE ; : yn-push ( addr1 -- addr2 ) DUP 1 CELLS SWAP +! DUP @ + ; : yn-pop ( addr1 -- addr2 ) DUP @ 0= IF DROP yn ELSE DUP DUP @ + @ >R -1 CELLS SWAP +! R> ENDIF ; : MAKESTACK: CREATE 0 , #200 ALLOT DOES> SWAP DUP 0= IF DROP yn-pop ELSE 0< IF yn-push ENDIF ENDIF ; MAKESTACK: btStack 0 VALUE matched : backoff -1 btStack ! ; : top 0 btStack ; : <bnf ]] matched IF yn backoff ELSE EXIT ENDIF [[ ; : bnf> ]] matched IF top DROP ELSE top TO yn ENDIF [[ ; : | ]] matched IF top DROP EXIT ELSE top DUP TO yn backoff ENDIF TRUE TO matched [[ ; IMMEDIATE : bnf: : <bnf ; IMMEDIATE : ;bnf bnf> POSTPONE ; ; IMMEDIATE : @token ( -- n ) text /text yn /STRING DROP C@ ; : +token ( -- ) matched NEGATE +TO yn ; : =token ( n -- ) @token = matched AND TO matched ; : tokn ( n "name" -- ) CREATE C, DOES> C@ =token +token ; : tkn CREATE DUP C, bounds ?DO I C@ C, LOOP DOES> BEGIN @token BL = WHILE +token REPEAT count bounds ?DO I C@ =token +token LOOP ; : bnf[ ( -- ) 0 1 btStack ! 0 TO yn TRUE TO matched ; : ]bnf ( -- ) /text TO yn ; 0 VALUE tknumber : begintki 0 TO tknumber ; : endtki tknumber begintki ; : tki CREATE 0 , #100 ALLOT DOES> SWAP DUP 0< IF DROP EXIT ENDIF #10 * + CELL+ ; : str! ROT >R DUP R@ C! R> 1+ SWAP CMOVE 1 +TO tknumber ; : chk BEGIN @token BL = WHILE +token REPEAT count 0 DO DUP I + C@ =token +token LOOP DROP ; tki noun begintki 0 noun S" cat" str! 1 noun S" dog" str! 2 noun S" ball" str! endtki TRUE noun ! 0 VALUE noun-cnt bnf: <noun> 0 TO noun-cnt BEGIN noun-cnt TRUE noun @ < WHILE noun-cnt noun chk | 1 +TO noun-cnt REPEAT ;bnf S" the" tkn <the> S" your" tkn <your> S" my" tkn <my> bnf: <det> <the> | <your> | <my> ;bnf S" chases" tkn <chase> S" bites" tkn <bite> bnf: <transv> <chase> | <bite> ;bnf S" jumps" tkn <jump> S" bites" tkn <ibite> bnf: <iv> <jump> | <ibite> ;bnf S" that" tkn <that> : <end-of-line> /text yn = TO matched ; BL tokn <blank> bnf: <ap> <det> <noun> <transv> | <that> <det> <noun> <transv> | <that> <transv> <det> <noun> | <that> <iv> ;bnf bnf: <np> <det> <noun> ;bnf bnf: <vp> <transv> <np> <ap> | <transv> <np> ;bnf bnf: <sn> <np> <ap> <vp> | <np> <vp> | <np> <ap> ;bnf : parsex ( c-addr u -- ) CR ." Cat example: " >text bnf[ <sn> <end-of-line> ]bnf matched IF ." matched " ELSE ." failed " ENDIF ; \ ( example 1 ) S" my cat chases your dog" parsex \ ( example 2 ) S" my cat that bites your dog chases the ball" parsex \ ( example 3 ) S" my cat that chases your bogeyman" parsex
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
Difficulty with Brad Rodriguez' screenful Eduardo Costa <edu500ac@gmail.com> - 2013-03-15 07:10 -0700
Re: Difficulty with Brad Rodriguez' screenful stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-15 17:06 +0000
Re: Difficulty with Brad Rodriguez' screenful Eduardo Costa <edu500ac@gmail.com> - 2013-03-15 11:27 -0700
Re: Difficulty with Brad Rodriguez' screenful Eduardo Costa <edu500ac@gmail.com> - 2013-03-15 13:06 -0700
Re: Difficulty with Brad Rodriguez' screenful Eduardo Costa <edu500ac@gmail.com> - 2013-03-15 13:43 -0700
Re: Difficulty with Brad Rodriguez' screenful "Elizabeth D. Rather" <erather@forth.com> - 2013-03-15 12:17 -1000
Re: Difficulty with Brad Rodriguez' screenful Eduardo Costa <edu500ac@gmail.com> - 2013-03-16 13:25 -0700
Re: Difficulty with Brad Rodriguez' screenful mhx@iae.nl (Marcel Hendrix) - 2013-03-17 00:18 +0200
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-17 02:13 +0100
Re: Difficulty with Brad Rodriguez' screenful "Elizabeth D. Rather" <erather@forth.com> - 2013-03-16 15:29 -1000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-18 02:03 +0100
Re: Difficulty with Brad Rodriguez' screenful "Elizabeth D. Rather" <erather@forth.com> - 2013-03-17 15:23 -1000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-18 04:16 +0100
Re: Difficulty with Brad Rodriguez' screenful "Elizabeth D. Rather" <erather@forth.com> - 2013-03-17 18:20 -1000
Re: Difficulty with Brad Rodriguez' screenful stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-18 13:07 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-18 21:45 +0100
Re: Difficulty with Brad Rodriguez' screenful Elizabeth D Rather <erather@forth.com> - 2013-03-18 12:13 -1000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 03:46 +0100
Re: Difficulty with Brad Rodriguez' screenful stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-19 09:42 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 17:04 +0100
Re: Difficulty with Brad Rodriguez' screenful stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-19 17:54 +0000
Re: Difficulty with Brad Rodriguez' screenful Brad Eckert <hwfwguy@gmail.com> - 2013-03-19 13:30 -0700
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 22:33 +0100
Re: Difficulty with Brad Rodriguez' screenful albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-19 13:03 +0000
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-19 14:56 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 21:55 +0100
Re: Difficulty with Brad Rodriguez' screenful Alex McDonald <blog@rivadpm.com> - 2013-03-19 14:16 -0700
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-20 02:09 +0100
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 20:35 +0100
Re: Difficulty with Brad Rodriguez' screenful stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-19 09:52 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 18:56 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-19 13:18 -0500
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 22:37 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-20 03:33 -0500
Re: Difficulty with Brad Rodriguez' screenful "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-03-20 05:30 -0400
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-18 11:28 -0500
Re: Difficulty with Brad Rodriguez' screenful Alex McDonald <blog@rivadpm.com> - 2013-03-18 15:39 -0700
Re: Difficulty with Brad Rodriguez' screenful albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-19 13:07 +0000
Re: Difficulty with Brad Rodriguez' screenful m.a.m.hendrix@tue.nl - 2013-03-19 06:58 -0700
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 03:05 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-19 05:27 -0500
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 19:24 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-20 03:42 -0500
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-20 03:54 -0500
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-20 17:49 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-20 12:51 -0500
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-20 20:25 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-21 04:31 -0500
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-21 16:31 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-21 14:48 -0500
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-21 18:07 +0000
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-21 14:49 -0500
Re: Difficulty with Brad Rodriguez' screenful Coos Haak <chforth@hccnet.nl> - 2013-03-22 00:07 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-21 18:31 -0500
Re: Difficulty with Brad Rodriguez' screenful Coos Haak <chforth@hccnet.nl> - 2013-03-22 00:48 +0100
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-22 01:49 +0100
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-27 17:30 +0000
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-22 03:57 -0500
Re: Difficulty with Brad Rodriguez' screenful Alex McDonald <blog@rivadpm.com> - 2013-03-22 03:39 -0700
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-22 09:03 -0500
Re: Difficulty with Brad Rodriguez' screenful Alex McDonald <blog@rivadpm.com> - 2013-03-23 08:13 -0700
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-23 12:39 -0500
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-23 14:19 -0500
Re: Difficulty with Brad Rodriguez' screenful Alex McDonald <blog@rivadpm.com> - 2013-03-23 13:01 -0700
Re: Difficulty with Brad Rodriguez' screenful Brad Eckert <hwfwguy@gmail.com> - 2013-03-22 08:13 -0700
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-22 14:44 +0000
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-22 10:34 -0500
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-22 15:39 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-22 20:38 +0100
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-22 20:54 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-22 12:27 -0500
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-22 17:38 +0000
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-22 13:48 -0500
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-23 11:53 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-24 01:46 +0100
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-27 17:04 +0000
Re: Difficulty with Brad Rodriguez' screenful Brad Eckert <hwfwguy@gmail.com> - 2013-03-25 10:06 -0700
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-19 16:05 +0000
Re: Difficulty with Brad Rodriguez' screenful Alex McDonald <blog@rivadpm.com> - 2013-03-19 12:32 -0700
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-18 18:28 +0000
Re: Difficulty with Brad Rodriguez' screenful stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-18 12:40 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-18 17:23 +0100
Re: Difficulty with Brad Rodriguez' screenful stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-18 17:35 +0000
Re: Difficulty with Brad Rodriguez' screenful Brad Eckert <hwfwguy@gmail.com> - 2013-03-18 11:02 -0700
Re: Difficulty with Brad Rodriguez' screenful "WJ" <w_a_x_man@yahoo.com> - 2013-03-19 03:25 +0000
Re: Difficulty with Brad Rodriguez' screenful albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-18 19:35 +0000
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-18 18:17 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 03:29 +0100
Re: Difficulty with Brad Rodriguez' screenful Paul Rubin <no.email@nospam.invalid> - 2013-03-19 00:06 -0700
Re: Difficulty with Brad Rodriguez' screenful Paul Rubin <no.email@nospam.invalid> - 2013-03-19 00:11 -0700
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 16:16 +0100
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-19 15:06 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-19 22:27 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-20 03:49 -0500
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-20 11:09 +0000
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-20 10:25 -0500
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-20 18:08 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-20 13:04 -0500
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-20 20:12 +0100
Re: Difficulty with Brad Rodriguez' screenful Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-21 04:39 -0500
Re: Difficulty with Brad Rodriguez' screenful albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-20 19:22 +0000
Re: Difficulty with Brad Rodriguez' screenful Alex McDonald <blog@rivadpm.com> - 2013-03-20 10:27 -0700
Re: Difficulty with Brad Rodriguez' screenful anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-20 12:03 +0000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-20 18:47 +0100
Re: Difficulty with Brad Rodriguez' screenful Eduardo Costa <edu500ac@gmail.com> - 2013-03-16 22:27 -0700
Re: Difficulty with Brad Rodriguez' screenful mhx@iae.nl (Marcel Hendrix) - 2013-03-17 10:10 +0200
Re: Difficulty with Brad Rodriguez' screenful mhx@iae.nl (Marcel Hendrix) - 2013-03-17 18:15 +0200
Re: Difficulty with Brad Rodriguez' screenful Eduardo Costa <edu500ac@gmail.com> - 2013-03-17 13:00 -0700
Re: Difficulty with Brad Rodriguez' screenful mhx@iae.nl (Marcel Hendrix) - 2013-03-17 23:34 +0200
Re: Difficulty with Brad Rodriguez' screenful Eduardo Costa <edu500ac@gmail.com> - 2013-03-17 16:44 -0700
Re: Difficulty with Brad Rodriguez' screenful "WJ" <w_a_x_man@yahoo.com> - 2013-03-17 23:53 +0000
Re: Difficulty with Brad Rodriguez' screenful mhx@iae.nl (Marcel Hendrix) - 2013-03-18 23:32 +0200
Re: Difficulty with Brad Rodriguez' screenful Lars Brinkhoff <lars.spam@nocrew.org> - 2013-03-19 08:12 +0100
Re: Difficulty with Brad Rodriguez' screenful m.a.m.hendrix@tue.nl - 2013-03-19 00:33 -0700
Re: Difficulty with Brad Rodriguez' screenful Lars Brinkhoff <lars.spam@nocrew.org> - 2013-03-19 09:39 +0100
Re: Difficulty with Brad Rodriguez' screenful mhx@iae.nl (Marcel Hendrix) - 2013-03-19 21:11 +0200
Re: Difficulty with Brad Rodriguez' screenful Elizabeth D Rather <erather@forth.com> - 2013-03-19 10:30 -1000
Re: Difficulty with Brad Rodriguez' screenful Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-03-19 22:31 +0100
Re: Difficulty with Brad Rodriguez' screenful Elizabeth D Rather <erather@forth.com> - 2013-03-19 12:09 -1000
Re: Difficulty with Brad Rodriguez' screenful Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-18 19:23 +0100
Re: Difficulty with Brad Rodriguez' screenful stephenXXX@mpeforth.com (Stephen Pelc) - 2013-03-16 06:34 +0000
Re: Difficulty with Brad Rodriguez' screenful junnia@gmail.com - 2013-03-19 07:45 -0700
Re: Difficulty with Brad Rodriguez' screenful mhx@iae.nl (Marcel Hendrix) - 2013-03-19 21:38 +0200
Re: Difficulty with Brad Rodriguez' screenful mhx@iae.nl (Marcel Hendrix) - 2013-03-23 01:31 +0200
csiph-web