Re: Past-pm basic string types
by Patrick R. Michaud other posts by this author
Dec 12 2006 1:20PM messages near this date
Past-pm basic string types
|
Re: Past-pm basic string types
On Tue, Dec 12, 2006 at 09:43:39AM -0800, Allison Randal wrote:
> Patrick, what's the best way to pass-through string types from a
> compiler to Parrot without doing full string processing? To pass the
> current tests, Punie only needs Parrot's single- and double-quoted
> strings, but Past-pm is escaping them.
PAST-pm expects it to be pretty rare that a HLL's string literal
format will exactly match what works as a string literal in PIR, so
PAST::Val nodes expect the HLL to have already decoded the string
constant according to whatever rules the HLL uses. Then PAST-pm
can re-encode the string into a form that is guaranteed to work
in Parrot (even handling things such as placing "unicode:" in
front of PIR string literals if the string has characters that
fall outside of the ASCII range.)
I can modify PAST-pm to provide a "send exactly this string to PIR"
option for PAST::Val. More generally useful would seem to be to
provide a generic function or opcode that can decode single/double
quoted strings according to PIR's encoding rules, and then use
that to get the string into PAST::Val.
PGE::Text could provide such a feature as part of its library-- i.e.,
subrules like:
" <PGE::Text::pir_quoted_string: "> "
' <PGE::Text::pir_quoted_string: '> '
could parse a valid pir string literal and provide the
decoded value as the result object.
> (I will add full string processing to Punie later, but since other
> compilers will also need basic Parrot string types, it makes sense to
> figure it out now.)
I think that the various languages have enough differences in
string literal handling that each compiler will end up writing
its own string literal decoder. (Or we need a semi-powerful library
to handle the many differences.) In the meantime having an
easy-to-access subrule for "just pretend it's a quoted literal
according to PIR conventions" might be a good way for someone
wanting to bootstrap a compiler, without placing Parrot-specific
encodings into PAST-pm.
Lastly, I'm still working out the handling of HLL to Parrot
type mappings -- it's also possible that some of this will
fall out as a result of that.
Pm
From: Ovid <publiustemp-perl6users@[...].com>
X-Virus-Check-By: mailtest2.pair.com
X-Spam-Check-By: mailtest2.pair.com
X-Spam-Status: No, hits=-2.6 required=4.3 tests=BAYES_00 autolearn=ham version=3.001007
X-Spam-Flag: NO
X-Spam-Level:
X-Spam-Filtered: 052f96e22adcb440ba93d277d4a1272f
Mailing-List: contact perl6-all-help@perl.org; run by ezmlm
Precedence: bulk
List-Post: <mailto:perl6-all@[...].org>
List-Help: <mailto:perl6-all-help@[...].org>
List-Unsubscribe: <mailto:perl6-all-unsubscribe@[...].org>
List-Subscribe: <mailto:perl6-all-subscribe@[...].org>
List-Id: <perl6-all.perl.org>
Delivered-To: mailing list perl6-all@[...].org
Delivered-To: perl6-all-poster@[...].org
Received-SPF: pass (x1.develooper.com: local policy)
X-Mailing-List: contact perl6-users-help@perl.org; run by ezmlm
X-Mailing-List-Name: perl6-users
List-Id: <perl6-users.perl.org>
Delivered-To: mailing list perl6-users@[...].org
Delivered-To: perl6-users@[...].org
Received-SPF: pass (x1.develooper.com: local policy)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
s=s1024; d=yahoo.com;
h=X-YMail-OSG:Received:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type
:Content-Transfer-Encoding:Message-ID;
b=ZgqfDa/+1D1LmXRDa3eZC2+AOqj8A8FhgirMb1Zx3QChSJO4Of76nelNaq5SZn2fg5SGTDX45sDb6SGy5vXWgc6d
CX8tqovtn9PfpOsJSwcIhwpHNRxdvlz7/g4VI8x36BfJX5ZCAwUK8nkZw4Je1hyeysJfyUKVhc4dZvgktp8=;
X-YMail-OSG: skcTaogVM1m0F1NqJesjxHpHGqcFc3R1Re5sCjQGa9jtx00faLwXwDfQgnJhdQFk1vTUyYtfDQLMYdL
wOtXN_bhTVwCBbptdqb1J8ohAHaBveeZGK7yf2BpuwzlF_u_FbcoOaLMyLyvIz2gG
Date: Tue, 12 Dec 2006 13:23:08 -0800 (PST)
Reply-To: publiustemp-perl6users@[...].com
Subject: Re: Error running Pugs tests
To: perl6-users@[...].org
In-Reply-To: <20061212120057.GM29200@[...].org>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Message-ID: <730032.89497.qm@[...].com>
X-Old-Spam-Check-By: la.mx.develooper.com
X-Old-Spam-Status: No, hits=0.8 required=8.0
tests=BAYES_00,DK_POLICY_SIGNSOME,DK_POLICY_TESTING,DK_SIGNED,DK_VERIFIED,DNS_FROM_RFC_ABUS
E,DNS_FROM_RFC_POST,DNS_FROM_RFC_WHOIS
--- Gaal Yahas <gaal@[...].org> wrote:
> On Tue, Dec 12, 2006 at 02:14:42AM -0800, Ovid wrote:
> > pugs $ pugs t/general/basic.t
> > pugs: user error (***
> > Unexpected "Str"
> > expecting "\\", ":", "*", parameter name or ")"
> > at /usr/local/lib/perl6/Test.pm line 34, column 21
> > t/general/basic.t line 1, column 1)
>
> You have an old version of Test.pm (and likely, other modules too)
> from
> an earlier 'make install'. Better wipe out your /usr/local/lib/perl6
> and any other traces.
Thanks. That fixed it. Now for some fun:
http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Prob
lems.html
or http://tinyurl.com/tt9e7
Cheers,
Ovid
--
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/
Thread:
Allison Randal
Patrick R. Michaud
Allison Randal
Patrick R. Michaud
|