%dbg { #ff #0e DEO } %sp { #20 #18 DEO } %nl { #0a #18 DEO } %exit { #01 #0f DEO BRK } |0100 ;expr1 ;compile JSR2 dbg nl ;emit-stack JSR2 nl ;emit-arena JSR2 nl ;test1 OVR2k ;match JSR2 ;emit-byte JSR2 sp ;test2 OVR2k ;match JSR2 ;emit-byte JSR2 sp ;test3 OVR2k ;match JSR2 ;emit-byte JSR2 sp ;test4 OVR2k ;match JSR2 ;emit-byte JSR2 sp ;test5 OVR2k ;match JSR2 ;emit-byte JSR2 sp ;test6 OVR2k ;match JSR2 ;emit-byte JSR2 sp ;test7 OVR2k ;match JSR2 ;emit-byte JSR2 sp ;test8 OVR2k ;match JSR2 ;emit-byte JSR2 nl ;test1 ;graph1 ;match JSR2 ;emit-byte JSR2 sp ;test2 ;graph1 ;match JSR2 ;emit-byte JSR2 sp ;test3 ;graph1 ;match JSR2 ;emit-byte JSR2 sp ;test4 ;graph1 ;match JSR2 ;emit-byte JSR2 sp ;test5 ;graph1 ;match JSR2 ;emit-byte JSR2 sp ;test6 ;graph1 ;match JSR2 ;emit-byte JSR2 sp ;test7 ;graph1 ;match JSR2 ;emit-byte JSR2 sp ;test8 ;graph1 ;match JSR2 ;emit-byte JSR2 nl ;reset-arena JSR2 exit ( corresponds to regex: a(b|c)d* ) @expr1 "a(b|c)d* 00 ( corresponds to regex: a(b|c)d* ) ( accepts "ab" or "ac" followd by any number of d's ) @graph1 03 'a :x1 @x1 04 :x2 :x3 @x2 03 'b :x4 @x3 03 'c :x4 @x4 05 :x5 0000 @x5 03 'd :x4 ( test case strings to try matching ) @test1 "ab 00 ( yes ) @test2 "acdd 00 ( yes ) @test3 "add 00 ( no ) @test4 "abd 00 ( yes ) @test5 "acddddddddddd 00 ( yes ) @test6 "bd 00 ( no ) @test7 "z 00 ( no ) @test8 00 ( no ) ~regex.tal