|
Parrot 4.7.0 "Hispaniolan" | parrot.org | Log: irclog.perlgeek.de/parrot | #parrotsketch meeting Tuesday 19:30 UTC Set by moderator on 4 September 2012. |
|||
| kid51 | Boa noite, whiteknight | 00:20 | |
| kid51 practices his Portuguese for class tomorrow | |||
|
00:42
benabik joined
|
|||
| whiteknight | hello kid51 | 00:48 | |
|
02:09
MikeFair joined
|
|||
| MikeFair | Good evening #parrot! :) | 02:12 | |
| I am havinga bit of a problem coming up with the Grammar syntax that works for the "if statement" I'm trying to make | 02:28 | ||
| The main problem I'm having is that there's no clearly defined end point every time so I'm having difficulty figuring out how to create the rule for it | 02:29 | ||
| if <EXPR> then <statement>* [ else <statement>* ]? ['end if']? | 02:30 | ||
| Is kind of what I'm looking for | |||
| however if there is no 'else' or 'end' 'if' after the 'then' - only one single statement should be included in the <thenPart> | 02:32 | ||
| and if there is no 'end' 'if' after the 'else' -only one single statement should be included in the <elsePart> | 02:33 | ||
| Examples I've looked at have assumed only one 'block' or one 'statment' would follow the then or else because they have used {} or similar delimiters | 02:34 | ||
| I've considered trying to make 'then' .* ['else' | 'end' ] a "block" type thing | 02:35 | ||
| But it would have to be more like <?before 'else' | 'end'> | 02:36 | ||
|
02:36
mvorl joined
|
|||
| MikeFair | Thoughts/discussion on the issue would be welcomed - thx | 02:37 | |
| hi there mvorl | |||
| mvorl | Hi MikeFair & #parrot | 02:38 | |
| sorear | hello! | ||
| MikeFair | hi there sorea! :) | 02:39 | |
| err sorear even! | |||
| sorear | MikeFair: if <EXPR> then <statement> [ <statement>* end if ] | ||
| extending this to handle else is left as an exercise. | |||
| MikeFair nods | 02:40 | ||
| sorear | actually it should be if <EXPR> then [ <statement> [ <statement>* end if ]? || end if ] | ||
| MikeFair | oh interesting | 02:41 | |
| sorear | this is an LL(infinity) grammar engine, you need to left-factor | ||
| MikeFair | I had this was 'almost working' | ||
| ule thenPart { | |||
| 'then' <statement>* <?before 'else' | 'end' 'if'> | |||
| | 'then' <statement> | |||
| but it didn't properly terminate when there was only one command and no end i | 02:42 | ||
| if | |||
| sorear | your use of <?before> there seems quite wrong. | ||
| also, it's not left factored. | 02:43 | ||
| MikeFair | Yeah I haven't been really mastering "left factoring" yet :) | ||
| It's gotten me into some cute trouble and I quickly learned "doctor it hurts when I infinitely recurse!" :) | 02:44 | ||
| MikeFair gives the above a shot. | |||
| the <?before> has seemingly been doing what I expect, "find the 'else' | 'end' 'if' and match the text before it | 02:46 | ||
| Explanations I've read online have explained it as like having a "run to this point" GOAL | 02:47 | ||
| but what I'm not clear on is how it will behave if the if statements are nested | |||
| sorear | here's how it really works: | 02:48 | |
| MikeFair | I'm expecting the recursive part should justtake care of that | ||
| sorear | regex position is before <statement>* <?before ...> | ||
| input looks like 1; 2; end if | |||
| MikeFair nodsl. | 02:49 | ||
| sorear | first we try to match a statement because <statement>* | ||
| 2; end if | |||
| now because * we match another statement | |||
| end if | |||
| now because * we try again | |||
| end if is not a statement, so the <statement> rule *fails* | |||
| <?before> sees that the current position is before "end if", so it does nothing | |||
| the only thing <?before> does is, sometimes, make matches fail | 02:50 | ||
| it has no effect on anything before or after it | |||
| MikeFair | But it has left the cursor in the right position for matching on the next part for me | 02:51 | |
| but that might have been a side effect of other things | |||
| sorear | <?before> never moves the cursor. | ||
| the cursor moved as a result of <statement> _only_ | 02:52 | ||
| MikeFair | sorear: It might not be needed anymore, I put it in there because I was having a problem with <statement>* consuming too much | 02:53 | |
| sorear | MikeFair: here's how that works: | ||
| MikeFair | but that was with a completely different attempt at using a <statement_list> instead of a <statement>* | ||
| sorear | if you put in <?before> and it *fails*, you backtrack | ||
| it forgets the last <statement> and pretends it didn't match after all | |||
| and tries again at the previous place | 02:54 | ||
| MikeFair | sorear: which in my case would trigger the alternate rule of 'then' <statement> | 02:55 | |
| but I think I can see why it's not working | |||
| dalek | rrot/native_pbc2: 8f65204 | rurban++ | / (3 files): Better bitfiddling with the intel 63 normalize bit cvt_num16_num10 clears now bit 63 cvt_num10_num16 tries to shift-copy the mantissa ignoring this bit Test precision regex seems to be stable now. |
02:57 | |
| Heuristic branch merge: pushed 196 commits to parrot by rurban | |||
| MikeFair | sorear: Doesn't seem to work | 03:09 | |
| rule if_expr { | |||
| 'if' ~ <?before 'then'> <EXPR> | |||
| 'then' [ <statement> [ <statement>* 'end' 'if' ]? || 'end' 'if' ] | |||
| oh wait, I still have that first before in there | |||
| MikeFair tries again | 03:10 | ||
| yeah same problem | |||
| 'if' <EXPR> 'then' [ <statement> [ <statement>* 'end' 'if' ]? || 'end' 'if' ] | |||
| if 1 then say 1; say 2; say 3; doesn't parse | 03:11 | ||
| if 1 then say 1; say 2; say 3; end if does | |||
| benabik | you want that first to be (if 1 then say 1;) say 2; say 3; ? | ||
| MikeFair nods | |||
| benabik | Why the || 'end' 'if' ? | 03:12 | |
| MikeFair | because sorear said so. :) I think it's explicitly handling the if 1 then end if case | ||
| if I read it right | |||
| (where there's no <statement> match) | 03:13 | ||
| benabik | ah | ||
| MikeFair | If you're really curious, the original BNF I'm copying is this: | 03:15 | |
| <ifBlock> = | |||
| if <logical> [ <return> ] then {<singleThen> | <return> <multiThen>} | |||
| They use 'then' <return> to start a multiThen | 03:16 | ||
| and 'then' <statement> to mean singleThen | |||
| where <return> = \\n | |||
| benabik | What about: 'if' <EXPR> 'then' [ <statement>* 'end' 'if' || <statement> ] | ||
| Not terribly efficient, but it should try to match all the statements, then look for an end if, fail to find it then just eat a single statment. | 03:17 | ||
| MikeFair | benabik: That's more the approach I was taking, but I don't think that's left factored | ||
| but I'll give it a shot | |||
| benabik | I think trying to do it without a disambiguator is going to be problematic. The original says no return = single, return = multi. | 03:18 | |
| MikeFair | 'if' <EXPR> 'then' [ <statement>* 'end' 'if' || <statement> ] | 03:19 | |
| same problem | |||
| benabik | There's no similar disambig in your grammar. | ||
| MikeFair | if 1 then say 1; say 2; say 3; doesn't parse | ||
| MikeFair tries using newlines instead | |||
| oh that's what I did hehe | |||
| ./installable_safire --target=parse -e 'if 1 then say 1 \\n say 2\\n say 3' | 03:20 | ||
| benabik | Is the if a rule or token? tokens refuse to backtrack. | ||
| MikeFair | rule if_expr | ||
| benabik | \\n inside single quotes doesn't do what you think, I think. | 03:21 | |
| MikeFair | benabik: Well usually if 1 then say 1; say 2; say 3; end if will parse | ||
| let's see | |||
| yep | |||
| ./installable_safire --target=parse -e 'if 1 then say 1 \\n say 2\\n say 3\\nend if' parses | 03:22 | ||
| Syntax error at line 3, near "say 2\\nsay " | |||
| benabik | MikeFair: '\\n' sends \\n to the program, not a newline. You need to use double quotes. | 03:23 | |
| MikeFair | benabik: Oh I'm hitting the <enter> key | ||
| not \\n | |||
| benabik | ah | ||
| MikeFair | I just didn't want to take up multiple lines in the channel here | ||
| Now this might be a problem with statement | 03:24 | ||
| the terminators ; and \\n are actually on "statement_list" | |||
| <statement>* %[ ';' | '\\n'] | |||
| err not '\\n' just \\n | 03:25 | ||
| ok, that seems to be acting better but I can't seem to make the ; || $$ work | 03:34 | ||
| I can get either one of them to work but not a mixture ofthe two... | 03:35 | ||
| I get the same results with either \\n or $$ | |||
| <ws> is not including \\n | 03:36 | ||
| WooHoo!! I have no idea if it's actually matching the right things, and anything complex takes forever to parse, but at least everything I expect to parse parses! | 04:21 | ||
| rule if_expr { | 04:22 | ||
| 'if' <EXPR> 'then' | |||
| [ <statement_list> [ 'end' 'if' || 'else' [ <statement_list> 'end' 'if' || <statement> ] ] | |||
| || <statement> ] | |||
| } | |||
| MikeFair heads off to tuck kids into bed. | |||
| :) | |||
|
04:30
bluescreen_ joined
04:36
eternaleye joined
04:42
particle joined
04:44
eternaleye joined
04:51
benabik joined,
benabik_ joined
|
|||
| MikeFair | benabik: wb | 04:56 | |
|
05:06
mvorl left
05:35
fperrad joined
07:02
brrt joined
08:09
lucian joined
08:19
Psyche^ joined
10:18
eternaleye joined
10:27
eternaleye joined
11:21
eternaleye_ joined
11:38
eternaleye_ joined
11:43
eternaleye_ joined
12:30
benabik joined
12:41
JimmyZ joined
12:42
mtk joined
12:51
PacoAir joined
13:25
bluescreen joined
14:02
rurban_mobile joined
14:13
benabik joined
14:18
nnunley joined
14:27
rurban_mobile joined
|
|||
| dalek | rrot/native_pbc2: b99bb67 | rurban++ | / (2 files): native numbers: document intel bit63 |
14:28 | |
| brrt | hi #parrot | 14:59 | |
|
15:00
dmalcolm joined
|
|||
| moritz | \\o brrt | 15:06 | |
| brrt | \\o moritz | ||
| did you perchance ever find out how and if you could load perl6 as a language and a compiler? | |||
| moritz | brrt: no. I only found out why it doesn't work right now | 15:07 | |
| (it only calls compreg in the compiling process, but it doesn't emit code for the compreg) | |||
| I have to bug jnthn about how to fix that | |||
| brrt | ok, great, thats good to know :-) | 15:08 | |
| benabik | Hm. Trying to build with Parrot/NQP/Rakudo master give me an error about not finding the 'os' library. I thought we installed a compatibility shim for that? | 15:11 | |
| Sorry, "trying to build Rakudo HEAD with Parrot/NQP HEAD", is more exactly what I meant. | |||
| Coke | I know we /talked/ about putting in a shim for that. I don't think I saw a commit (but could have missed it) | 15:44 | |
|
15:46
sivoais joined
16:47
patspam joined
17:25
benabik joined
17:32
benabik joined
17:37
benabik joined
17:40
benabik joined
17:42
benabik joined
17:47
benabik joined
|
|||
| dalek | rrot/native_pbc2: 4afbef5 | rurban++ | src/packfile/pf_items.c: pf_items: keep const qualifiers |
17:47 | |
|
18:00
benabik joined
18:38
dmalcolm joined
|
|||
| rurban_mobile | benabik: we already have an empty dynpmc os for the rakudo problem | 18:47 | |
| benabik | rurban_mobile: Except that I tried to build Rakudo and it failed because it couldn't find library 'os' | ||
|
18:52
lucian joined
|
|||
| Coke | benabik: how did you build rakudo? pre-installed parrot or with -gen-parrot? | 18:57 | |
| benabik | Pre-installed | ||
| Built Parrot HEAD, NQP HEAD, Rakudo HEAD | |||
| Coke | pre-existing older version of parrot installed? | ||
| I do see rurban++'s commit for the backward compat. you at d76bef8 or later? | 18:59 | ||
| benabik | yeah | 19:01 | |
| rurban_mobile | Yes, d76bef83f04f62f3e5871a6695526eb600b0d7a2 it was. I forgot to include into the original bdw/move-os branch | ||
| benabik is at a54a581 | |||
| rurban_mobile | I'm just rescuing my harddisc from the texan weekend power spike which blew up parts of the disc. | 19:02 | |
| benabik | Exact error (while building the setting): error:imcc:loadlib directive could not find library `os' in file '(file unknown)' line 1 | 19:13 | |
| class & | 19:19 | ||
| rurban_mobile | benabik: is there a dynpmc/os? | 19:23 | |
| I could imagine that dynpmc/os did not get installed. | 19:25 | ||
|
19:34
contingencyplan joined
|
|||
| Coke | benabik: look for the commit that removed it, then the commit that added the stub back, and find the difference. | 19:57 | |
| rurban++ is probably right about missing something on the install. | |||
|
20:05
lucian joined
|
|||
| rurban_mobile | I'll need about a day to recover my system | 20:13 | |
|
20:54
benabik joined
20:58
benabik_ joined
21:10
lucian joined
22:14
jlaire joined
22:43
whiteknight joined
23:18
GeJ_ joined,
benabik joined,
perlite joined
23:21
patspam joined
23:27
ingy joined
23:33
mj41 joined
|
|||