Hmm...

The basic purpose of the new backtrack mechanism is to allow token
formation rules to depend on characters which have not yet been
encountered but which will be encountered soon. It also introduces
some new risks, as a consequence -- the possibility of infinite loops
and the possibility of emitting tokens containing characters which
have been emitted in previous tokens. The possibility of emitting an
empty token lies right on the boundary of that second risk area.

Testing, I get an index error when I try to emit an empty token.

states=: 3 :0
 0 10 #: <. 10 * > -.&a: <@".;._2] 0 :0
)

splitword=: 0;(states'');a.e.' ',CRLF,TAB
  1.1   0          NB. 0 whitespace
  1     0.3        NB. 1 other
)

splitword2=: 0;(states'');a.e.' ',CRLF,TAB
  1.1   0          NB. 0 whitespace
  2.7   2.7        NB. 1 whitespace had ended, backtrack
  3.2   3.2        NB. 2 empty on whitespace end
  3     0.3        NB. 3 other
)

   splitword ;: 'this is a test' NB. this works
   splitword2 ;: 'this is a test' NB. index error

So either my test is flawed, or the implementation gives an index
error for backtracking past the start of a token.

Thanks,


--
Raul

On Sat, Nov 14, 2020 at 7:57 PM 'Pascal Jasmin' via Programming
<[email protected]> wrote:
>
> Can this be used to emit empty words?  What are some imagined uses of this 
> code?
>
>
> http://www.jsoftware.com/pipermail/programming/2017-March/046910.html
>
> suggested  ew when j=_1 should emit empty box/word instead of crashing, 
> seemed simple enough, but I don't understand this addition yet.
>
>
>
>
>
>
>
>
>
>
>
> On Saturday, November 14, 2020, 05:08:33 p.m. EST, Henry Rich 
> <[email protected]> wrote:
>
>
>
>
>
> I have been rewriting interfaces to make the JE reentrant.  This beta
> has changes in I/O to the front end, which has more ramifications than I
> can test for.  I am hoping the beta users will cover the combinations &
> report anything that looks unusual.
>
> This beta has the new backtrack function for (x ;: y).
>
> Henry Rich
>
> On 11/14/2020 5:05 PM, Eric Iverson wrote:
> > J902-beta-m available for windows/macos/linux.
> >
> > If you already run 902-beta, then upgrade is easy:
> >    load'pacman'
> >    'upgrade'jpkg'jengine'
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to