Parrot 1.9.0 "Blue-fronted Amazon" released! | parrot.org | Priorities: Add deprecations for 2.0; test platforms; check with HLL implementors | Roadmap: icanhaz.com/parrotroadmap | Latest modified TT's: icanhaz.com/parrotbugs
Set by moderator on 9 January 2010.
Tene the regex stuff comes from the 'match' rule, fwiw. 00:00
cconstantine github.com/tene/steme/blob/master/s...mar.pg#L33 00:03
Tene Yes, that declares a protoregex variant.
just like L42, L47, ... 00:04
or were you asking about the contents ofthe macro rule itself? 00:05
cconstantine yes
Tene What do you want to know about it? You're very terse. :)
cconstantine sorry, trying to read your code 00:06
umm, so.. I'm mostly lost
Tene $*foo is dynamicaly scoped.
when I parse 'macro' and then a symbol, I save that symbol into a context variable so that it's then available when I parse _ in a pattern later (_ matches the name of the macro being matched) 00:07
cconstantine so if this gramar sees: (macro foo ...) it stores a macro named 'foo'? 00:08
Tene Yes, steme implements basic macros.
cconstantine there is so much more to macros 00:09
Tene It actually modifies the parser by installing additional protoregex variants after parsing the macro definition.
cconstantine ok
what does line 39 do?
Tene line 39 is the same as "$<action>=<.q_item>" 00:10
It just assigns a different name in the match object produced.
the leading . before q_item says to not include that match under that name in the match object produced. 00:11
just like you'll see people use <.ws> to match whitespace, but not save the matched whitespace in the match object.
cconstantine line 34 is really 'macro' ? or... <sym> is replaced with 'macro' ? 00:15
Tene cconstantine: <sym> in a rule will be replaced with whatever was in the :sym<...> in the rule declaration.
cconstantine ok 00:16
Tene So yes, <sym> is replaced with 'macro'
cconstantine cool 00:18
so, starting with github.com/tene/steme/blob/master/s...ons.pm#L69 could you explain each line in that method? (sorry, I'm just seeing a lot of new-to-me features)
Tene That's using something that's likely to go away eventually, I hear. 00:19
The summary is that {*} means "call the appropriate method in the action class"
the #= foo on a line with a {*} means "pass 'foo' as a second argument to the action method" 00:20
cconstantine uh, I'm looking in actions.pm now
and {*} is going away? 00:21
Tene Oh, right.
>.>
cconstantine :)
Tene I didn't look at the email closely.
The #= foo thing might be going away, according to vague murmuring from TimToady.
cconstantine ok, I'm mostly ok with that 00:22
Tene okay, action.pm:69
the way I handle macros is that when I parse them, I actually install additional regexes in the grammar and methods in the actions class. 00:23
cconstantine I get the feel of that from the code, I just don't know how it's done 00:24
Tene so if I have: (macro foo (_ a) (...)), then I install a regex named special:sym<foo> that matches like {'foo' $<a>=<.item>}.
cconstantine (Q:PIR {%r = ....} ) executes '...' as PIR code and it's value is %r ? 00:25
Tene That's what happens in lines 71-75
Yes.
%r is the return reguster.
register
purl somebody said register was working with vs 2008 and strawberry perl
cconstantine thank you purl
purl You're welcome
Tene the method that I install in the actions class is the 'macroeval' method that you see below. 00:26
cconstantine ok, so it just executes the stuff in {}s
Tene 81-99
purl -18
Tene Yes.
cconstantine ah, so 70 adds the body of the 'macroeval' method to the 'Steme';'Grammar';'Actions' namespace under the name 'special:sym<' ~ $<symbol> ~ '>' 00:28
Tene Yes.
Exactly.
in line 66, I save the macro body (the "(...)" from above) in a global hash. 00:29
Then in macroeval, I fetch the body back out, keyed on the macro name (I only support macros that start with _ right now, which sets that), and then do some setup (awkward right now) and re-evaluate it. 00:30
cconstantine you save the macro as a string literal? 00:31
Tene cconstantine: Yes.
cconstantine ah, so you can compile it... it's hard to start the compiler at a stage 00:32
at a named stage that is
Tene Well, no, you just invoke a different compiler. I'd love to have parameterizable ASTs, but that wasn't the part I was concerned about right then.
My main concerns were: 1) modifying the parser at parse time, and 2) generating a regex from a s-exp, for the match part of the macro. 00:33
so I just did the simplest thing I could think of that worked for that. 00:34
cconstantine simple :)
speaking of simple... here's my state: github.com/cconstantine/Reason
it's not nearly as complete 00:35
but it generates 'cons' trees in the 'expr' action, and compiles the cons trees in the only way it knows howto (to method calls)
Tene I have more intelligence in the code than I probably want. I need to think more about storing things as s-exprs, and then compiling those to PAST, like you might be doing. 00:36
cconstantine I'm pretty sure that's waht I'm doing 00:37
and I mostly stumbled upon it so it can most likely be cleaned up a lot
Tene Add another compiler stage, so instead of parse->past->..., it goes parse->sexp->past->...
cconstantine I found that I didn't need another stage
at least not yet
Tene Is a plan I'm considering, I meant.
cconstantine ah 00:38
i tried that and found it problematic
Tene I really have negligible experience with lisp and scheme, so I don't know if I'm doing anything vastly stupid yet. :)
cconstantine ah 00:39
wait
to define a macro that returns code equivalent to (if cond a b) you write:
Tene Right now I have a separate set of rules for quoting, that mirror the rules for actual code.
cconstantine (macro (_if cond a b) (if cond a b))
?
Tene (macro my-if (_ cond a b) (if cond a b)) 00:40
_ in a match is the same as <sym> in a regex.
github.com/tene/steme/blob/master/t/05-macro.t
cconstantine ok, so that works for template sty macros....
Tene oh, I still left it like that? Ew, that's not right... 00:41
cconstantine can you write a macro that generates a list?
Tene apparently I left it using :foo to interpolate macro arguments.
cconstantine (defmacro (foo a b) (list if a b))
Tene I'm not sure if I know what that means. 'sec. 00:42
cconstantine macros are code that executes at compile-time, and the result is what's compiled
Tene So if I called (foo 1 2) it would be the same as '(if 1 2) ? 00:43
cconstantine it would be the same as (if 1 2)
because the (list ...) would execute at compile time and return a list (if 1 2)
Tene No, I don't handle that at all.
cconstantine and the compiler would see the list (<a symbol named if> <constant 1> <constant 2>) and compile it 00:44
ok, that's the heart of what a macro is
Tene As I said, I don't have a s-exp compiler.
cconstantine ok :)
My plans for the s-exp compiler is basiclly a table of methods (key: form/macro name, value: compiler_func) 00:46
and for each s-expr to compile if the first element of an s-expr is a string/simple-symbol (undecided about this) I lookup the compiler
if a compiler isn't found I use the default s-expr-is-method-call compiler 00:47
so things like 'or', 'lambda', 'if', would be in the method table
I currently need a) that table, b) the ability to go from PAST to code I can execute before leaving the parse stage 00:50
Tene b) is easy.
cconstantine I hope so :)
Tene my $compiler := Q:PIR { %r = compreg 'PAST' };
my $code := $compiler.compile($past);
actually, don't even need the Q:PIR 00:51
cconstantine how do I execute $code then?
Tene my $compiler := pir::compreg__PS('PAST');
cconstantine or is $code the return value of the $past 00:52
Tene it's an Eval object. It contains a list of Subs.
for each .sub generated, you get a reference in the $code object.
cconstantine fantastic. what's an Eval object and a Sub?
00:52 szabgab joined
Tene Sub is parrot's function class. 00:52
so if your past only compiles to one pir .sub, you can get that in $code[0], and then it's a code reference that you can invoke like anything else. 00:53
cconstantine so, "$code[0]()" 00:54
Tene so what you want to do for testing is first just compile it to pir, with: my $pir := $compiler.compile($past, :target('pir'));
Then print the pir to confirm that it has what you expect.
Yes.
cconstantine PAST::Block objects are Subs?
Tene Yes. 00:55
cconstantine w00t, I got it :)
Tene :D
cconstantine so if I got multiple Subs I could iterate over them and execute them all
Tene Yes.
cconstantine awesome
Oh the ironies... I'm using perl to make a lisp because I hate complicated syntax :) 00:56
Tene I really need to get the existing languages up to date with HLL interop support, and then add that to create_language.pl 00:57
cconstantine existing languages?
Tene Rakudo, partcl, cardinal, pynie, steme, lolcode, etc. 00:58
cconstantine and create_language.pl doesn't add in HLL support? 01:07
HLL interop I should say 01:08
Tene Kinda. It registers a compiler that inherits from HLLCompiler, which does some of it. 01:10
cconstantine Ahhh 01:12
and yup, doing the code given above I can execute user code at compile-time w00t w00t 01:13
01:19 ZeroForce joined 01:20 allison joined
allison do we need big deprecation tickets for PGE and NQP? 01:20
01:38 ZeroForce1 joined
dalek TT #1405 created by allison++: [DEPRECATED] get_results opcode before call 01:41
01:47 ZeroForce joined
dalek TT #1406 created by allison++: [DEPRECATED] get_results opcode used to fetch exception object 02:13
TT #1407 created by allison++: [DEPRECATED] CPointer and CPointer-style return argument handling
02:15 ZeroForce joined 02:17 cognominal joined
dalek tracwiki: v8 | allison++ | AllisonTasklist 02:20
tracwiki: trac.parrot.org/parrot/wiki/Allison...ction=diff
02:59 Psyche^ joined
bacek allison, CPointer isn't used for PCC already. 03:57
allison bacek: yes, I know, but we're still using the pointer technique 04:26
bacek: and the PMC is still floating around and needs to be cleaned out 04:28
bacek: (removed)
dalek rrot: r43415 | allison++ | trunk/DEPRECATED.pod:
Add a some deprecation items from the calling conventions.
04:36
rdinal: 62ad078 | fperrad++ | (14 files):
Merge remote branch 'cardinal/master'
05:43
rdinal: 10dca74 | fperrad++ | (5 files):
update infrastructure with setup.pir (distutils)
rdinal: e68c574 | fperrad++ | plumage/cardinal.json:
add a Plumage description
treed Fucking github's pull request thing is broken.
I had to do the merge locally.
05:43 cognominal joined 05:45 allison joined 06:11 bacek joined 08:16 nuba joined 08:45 cognominal joined
dalek rrot: r43416 | bacek++ | branches/gc_encapsulate:
Branch for encapsulate GC more
09:27
09:37 szabgab joined 09:38 fperrad joined 10:17 bacek joined
bacek o hai 10:18
10:55 szabgab joined 11:10 iblechbot joined 11:44 barney joined
dalek rrot: r43417 | barney++ | trunk/t/codingstd/copyright.t:
Mark 'tools/dev/create_language.pl' as having duplicate copyright statements.
11:52
12:13 jsut_ joined 12:40 AndyA joined 12:51 joeri joined 13:58 payload joined
dalek rrot: r43418 | barney++ | trunk/tools/dev/install_dev_files.pl:
Improved code comment, mentioned invocation from test scripts.
14:02
rrot: r43419 | barney++ | trunk/t/tools/install (3 files):
Mention install_doc_files.pl in POD.
14:09 mikehh_ joined 14:36 mikehh joined 15:11 cognominal joined 15:13 Psyche^ joined 16:11 payload joined 17:06 cognominal joined 17:11 theory joined
cconstantine How do I detect (in nqp) that a key is not in a hash? 17:21
18:04 allison joined 18:05 davidfetter joined 18:38 tetragon joined 18:40 theory joined 19:24 mikehh joined 19:37 mj41 joined 19:53 ZeroForce joined 20:10 payload joined 20:24 joeri left
mikehh manifest_tests FAIL - all others PASS (pre/post-config, make corevm/make coretest, smoke (#31587), fulltest) at r43419 - Ubuntu 9.10 amd64 (g++ with --optimize) 20:27
nopaste "mikehh" at 81.149.189.7 pasted "manifest_tests failures at r43419" (33 lines) at nopaste.snit.ch/19248 20:29
20:34 bacek joined
bacek good morning 20:35
msg kid51 I can't reproduce TT#1393 on my Linux/i386 box... Debian, gcc 4.3.4. 20:36
purl Message for kid51 stored.
20:52 payload1 joined 21:04 cognominal joined
dalek tracwiki: v139 | DurfWerzel++ | WikiStart 21:25
tracwiki: trac.parrot.org/parrot/wiki/WikiSta...ction=diff
mikehh can someone enlighten me if the change by DurfWerzel - trackwiki: v139 is legit 22:08
cotto definitely not 22:09
mikehh and if so it needs clarification
cotto It'd be less suspicious if the url didn't contain a misspelling. 22:10
mikehh it seems to go to some Wordpress login page 22:12
cotto It's clobbering time. 22:13
dalek tracwiki: v140 | susieb++ | WikiStart 22:14
tracwiki: trac.parrot.org/parrot/wiki/WikiSta...ction=diff
cotto this does not bode well 22:15
mikehh who is the tracwiki admin 22:16
cotto coke iirc 22:18
dalek tracwiki: v141 | cotto++ | WikiStart 22:31
tracwiki: clean up some spam
tracwiki: trac.parrot.org/parrot/wiki/WikiSta...ction=diff
22:34 patspam joined
Coke coke is /A/ tracwiki admin. whatchu need? 22:46
crap. I don't have my trac password atm. 22:47
cotto we have a couple more spammers 22:48
Coke I need to fix a few things locally before I can re-open my password vault. 22:51
22:53 AndyA joined, payload joined 22:59 nuba joined 23:38 theory joined
dalek TT #1408 created by mikehh++: manifest_tests failures introduced at r43406 23:39
23:55 cconstantine joined