World: r3wp
[!REBOL3 Parse] REBOL3 Parse
newer | last |
Sunanda 14-Jan-2011 [1] | [new group for R3 parse discussions, as requested] |
Steeve 14-Jan-2011 [2] | Brian, yes I will provide a special (already constructed ) rule to parse stream of valid rebol value/word |
BrianH 14-Jan-2011 [3] | Would this be a good place for TRANSCODE discussions too? |
Steeve 14-Jan-2011 [4] | I think it is IMHO |
BrianH 14-Jan-2011 [5x3] | A couple projects that I would find interesting: |
- A recovering loader for REBOL source (using TRANSCODE and a manually created stack) - A dialect compiler for R3 PARSE rules that generates the R2 workaround code | |
Steeve, if that rule is already constructed, it could have use beyond an incremental parser. Any chance it could be MIT licensed for inclusion in R2/Forward as a TRANSCODE backport? | |
Steeve 14-Jan-2011 [8] | Well, I alredy have in my mind to use the lexer to perform an incremental loader. So that, we could use it to perform incremental execution of rebol code -> a code DEBUGER |
BrianH 14-Jan-2011 [9] | Yup, IDEs need debuggers :) |
Steeve 14-Jan-2011 [10x2] | that was the idea behind areat-tc to begin with, but my design was too much narrow minded. It ended in a bloated huge script of 45 Kb, with bad readability. It''s requesting a more moldular approach. I think I learn a lot after such mistake. |
But some ideas stay relevant. Incremental parsing. Allowing incremental syntactical checkings. Allowing fast modification of the document (sort of DOM capability). Only what is modified indue styles reconstruction and rendering. | |
BrianH 14-Jan-2011 [12] | (Copied here) If you are using PARSE for incremental parsing, watch out for this: http://issue.cc/r3/1787 |
Steeve 14-Jan-2011 [13] | No prob, I was here during the related discussion. |
BrianH 14-Jan-2011 [14] | Btw, if there are other bugs in R3's PARSE that need to be discussed before being submitted to CureCode, this seems like a good group to do so. |
shadwolf 14-Jan-2011 [15] | could this be linked with a wiki page in rebolfrance.info and alimented with the tips and tricks from here ? |
BrianH 14-Jan-2011 [16x2] | Don't forget this: http://www.rebol.net/wiki/Parse_Project |
Ladislav has been updating that page lately, but it could use acceptance status references. | |
Steeve 14-Jan-2011 [18] | No prob, I already overpower parse In My not so Humble Opinion. I already have many attempts with incremental parsing, even with R3. I just try to come with the best design. |
BrianH 14-Jan-2011 [19] | Does anyone know if there is any difference between the REJECT and FAIL operations? Was REJECT just added as a FAIL synonym because ACCEPT was added? |
Steeve 14-Jan-2011 [20x4] | The internal representation of the Document is the hard point. Incremental parsing means caching some infos during parsing. What to cache, what not to cache, and in which form, that is the question. |
same question with accept and break. | |
maybe just synonym currently | |
Btw, i found a bug I think, with INTO | |
BrianH 14-Jan-2011 [24] | There was a change to INTO in R3, so any bugs in it might be that, or related to that. What bug? |
Steeve 14-Jan-2011 [25x2] | INTO [... accept] or INTO [.. break ] will fail if the serie position is not advanced of at least one step before the accept or break. |
(not sure I'm clear) | |
BrianH 14-Jan-2011 [27] | Not clear, because I can't replicate the bug from the description. |
Steeve 14-Jan-2011 [28x2] | Well, it's worst, you can't exit from an INTO command with ACCEPT or BREAK |
>> parse ["12"][into [2 skip] ??] end!: [] == true >> parse ["12"][into [skip accept] ??] == false should be true to my mind | |
BrianH 14-Jan-2011 [30] | ACCEPT and BREAK break from loops, though loops might not mean what you think they mean. |
Steeve 14-Jan-2011 [31] | so you have to use the same trick than with R2 TO END |
BrianH 14-Jan-2011 [32] | The block passed to INTO is (in theory) supposed to be treated the same as a top-level rule passed to PARSE. |
Steeve 14-Jan-2011 [33] | Yeah but... I'm a little disappointed |
BrianH 14-Jan-2011 [34x2] | The top-level rule is the only rule that isn't considered to be a loop, but I guess that counts for INTO as well. All other rules have an implicit 1 1 loop around them. |
It's like wrapping every statement in a LOOP 1 [...] in the DO dialect. | |
Steeve 14-Jan-2011 [36] | so far, the syntactical rules for rebol scripts. https://docs.google.com/document/pub?id=1kUiZxvzKTgpp1vL2f854W-8OfExbwT76QUlDnUHTNeA (Not produced the transcode rule though) But it's enough to perform the prefetch of a document and to construct the internal representation. |
BrianH 14-Jan-2011 [37] | >> parse [] [reject] == true >> parse [] [fail] == false Apparently REJECT only works on loops. |
Steeve 14-Jan-2011 [38] | yep, has to be notified in the Doc if not |
BrianH 14-Jan-2011 [39x3] | Note: If using the new TO or THRU syntax to recognize something that would require a QUOTE to recognize otherwise, use the QUOTE in the TO or THRU. If you don't, there are bugs. |
>> parse [1] [thru [quote 1]] == true >> parse [1] [thru [1]] == true ; should be a syntax error >> parse [1] [thru [1 2]] == true ; should be a syntax error >> parse [1] [thru [1 2 1]] == true >> parse [1] [thru [1 2 2]] == true ; should be false >> parse [1] [thru [1 2 1 1]] == true ; should be a syntax error >> parse [1] [thru [quote 2]] == false | |
According to the original proposal and what Carl said when he implemented it, >> parse [1] [thru [1 2 1]] == true should be a syntax error too. | |
Ladislav 14-Jan-2011 [42] | Difference between REJECT and FAIL: >> parse [] [while [reject]] == false >> parse [] [while [fail]] == true |
Steeve 14-Jan-2011 [43] | THRU and TO have lot of restrictions. You can't use them with charsets. you can't use nested sub-rules or anything else than simple values. |
BrianH 14-Jan-2011 [44] | It is best to use the correct syntax for now if you want your rules to work. You can't count on PARSE to trigger syntax errors when it should, for now. |
Ladislav 14-Jan-2011 [45] | (FAIL is a rule that fails, while REJECT makes the rule that contains it fail, even if it is WHILE, or ANY) |
BrianH 14-Jan-2011 [46] | Steeve, that is correct, but problem is that you aren't supposed to be able to "use nested sub-rules or anything else than simple values" except QUOTE, but PARSE is doing things incorrectly instead of triggering the error it ie supposed to trigger. |
Ladislav 14-Jan-2011 [47] | as opposed to that, ACCEPT and BREAK don't differ |
Steeve 14-Jan-2011 [48] | Ladislav, it makes sense |
Ladislav 14-Jan-2011 [49] | Steeve instead of TO RULE use WHILE [at rule break | skip | reject], and instead of THRU RULE use WHILE [rule break | skip | reject] |
Steeve 14-Jan-2011 [50] | I know, I already use it, though, I use some [..] more frequently |
newer | last |