Michael Haupt | 17 May 16:43
Picon
Favicon

let syntax in Jolt2

Dear list,

reading the Jolt2 boot.k, I stumbled over this bit of code (in the  
send syntax definition):

-----
(let ((send '(let ((__s : 0) (__r : 1))
		     (let ((__c (_bind __s __r)))
		       : 2))))
-----

Can someone explain what the colons are supposed to mean?

Best,

Michael

--

-- 
Dr.-Ing. Michael Haupt                michael.haupt@...
Software Architecture Group           Phone:  ++49 (0) 331-5509-542
Hasso Plattner Institute for          Fax:    ++49 (0) 331-5509-229
Software Systems Engineering          http://www.swa.hpi.uni-potsdam.de/
Prof.-Dr.-Helmert-Str. 2-3, D-14482 Potsdam, Germany

Hasso-Plattner-Institut für Softwaresystemtechnik GmbH, Potsdam
Amtsgericht Potsdam, HRB 12184
Geschäftsführung: Prof. Dr. Christoph Meinel

Attachment (smime.p7s): application/pkcs7-signature, 2834 bytes
(Continue reading)

Michael FIG | 15 May 12:12
Favicon

Re: Cannot run pull: repository is unrelated?

Hi,

Kurt Stephens <ks@...> writes:

>  > hg qclone http://fig.org/ocean/hg.cgi ocean

Ah, that's it.  There's apparently a bug in "hg qclone" that causes it
to refetch the main repository instead of getting the MQ patch repo.

Follow the instructions at:

http://vpri.org/fonc_wiki/index.php/Sources

for getting the changesets plus patches.  Basically, run just "hg
clone ...", then do a "sh pull".

Hope this helps,

--

-- 
Michael FIG <michael@...> //\
   http://michael.fig.org/    \//

Kurt Stephens | 7 May 17:38

Cannot run pull: repository is unrelated?

 > sh pull
pulling from http://fig.org/ocean/hg.cgi
searching for changes
no changes found
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
pulling from http://fig.org/ocean/mq.cgi
searching for changes
abort: repository is unrelated

What's going on here?

I have some fixes to libid I'd like to contribute.

Kurt Stephens
http://kurtstephens.com

Michael FIG | 6 May 02:36
Favicon

incorrect string literal quasiquotation in jolt2

Hi,

The following crashes Jolt2:

(syntax test-quasiquote
  (lambda (node compiler)
    (let ((expr `(printf "hello world\n")))
      [StdOut print: expr] [StdOut cr]
      expr)))
(test-quasiquote)

The output is:

(#printf (104 101 108 108 111 32 119 111 114 108 100 10))

I can see from function/jolt2/boot.k that quasiquote doesn't handle
constant strings correctly, so they get treated as if they are a list
of integers (because they are vectors too).

I don't know how to fix this right now given the tools in the current
Jolt2 parser.  Are there any suggestions?

--

-- 
Michael FIG <michael@...> //\
   http://michael.fig.org/    \//

Michael FIG | 2 May 15:02
Favicon

PipeStreams (aka. generators)

Hi all,

I created an interesting derivative of function/objects/Stream.st
called PipeStream.st.  It uses the POSIX <ucontext.h> functions to
implement fully deterministic coroutine-based streams whose producer
is a BlockClosure.  Any attempt to read the stream transfers control
to the producer coroutine (running on the same OS thread) where it
attempts to provide enough data to fill the request.  From the
producer's point of view, they just run to completion.

It's like other languages' "generators" feature, but without having to
do an explicit "yield".  The PipeStream machinery just detects when
you write enough objects back to it (or write a few then exit), then
resumes control in the reader.

I'm quite happy with it, and will be using it to separate my C
preprocessor into multiple pipelined parsing stages so that each stage
is independent and easier to debug.

The only downside I can see is that <ucontext.h> is not all that
common.  I don't know if something like it exists for Windows
(actually, NT Fibers could be abused to provide the same thing, I
think) or MacOS.  GNU Pth provides similar functionality, so it may be
possible to learn how to reimplement the context-switching features on
other platforms.

You also have to assign some stack space to the BlockClosure, and
eventually, it will be best to allocate that space from the caller's
stack so that it has the correct permissions.

(Continue reading)

Michael FIG | 2 May 05:35
Favicon

Jolt2 grammar questions

Hi Ian (since I think you're the only person who can answer),

I'm trying to parameterize a Jolt2 grammar so that it can vary based
on runtime function calls.  What I would like is similar functionality
to OMeta's semantic predicates.

Here's a snippet from the grammar to illustrate the situation:

   // Not necessarily the best syntax, but is chosen to mean that
   // doTrigraphs matches iff [self trigraphsEnabled] evaluates
   // to nonzero.
   doTrigraphs	=? [self trigraphsEnabled]

   // This is a backslash trigraph.
   trigraphBs	= '??/' <- '$\\

   // This matches either a regular backslash, or a trigraph version
   // if [self trigraphsEnabled] evaluates to nonzero.
   backslash	= '\\' | doTrigraphs trigraphBs

BTW, a somewhat related question: what are the '=>' and '<=' grammar
operators?  I tried understanding them, but there are no examples, and
the code was not obvious.

Thanks,

--

-- 
Michael FIG <michael@...> //\
   http://michael.fig.org/    \//

(Continue reading)

Michael FIG | 1 May 03:50
Favicon

working on a C grammar

Hi all,

I was wondering if any of you out there have a freely licensed PEG for
C?  I'm interested in combining it with a C preprocessor grammar to
start interpreting (or compiling via Slink) some C code.  With a
little work, this would be extensible to handle Id code, and then we'd
be one step closer to bootstrap.

If not, I have at least a decent BNF reference at
http://ivs.cs.uni-magdeburg.de/~puma/UsersManual/HTML/node12.html
though I would rather start from something that has all the operator
precedences completed in PEG format.

Thanks,

--

-- 
Michael FIG <michael@...> //\
   http://michael.fig.org/    \//

Michael Haupt | 30 Apr 21:39
Picon
Favicon

tutorial update

Dear all,

just a brief notice that my COLA tutorial ("Implementing Brainfuck in  
COLA") is available in an updated version. The update does not bring  
anything fundamentally new, just enhancements, mostly in terms of  
accuracy.

http://www.swa.hpi.uni-potsdam.de/tutorials/cola/index.html

Best,

Michael

--

-- 
Dr.-Ing. Michael Haupt                michael.haupt@...
Software Architecture Group           Phone:  ++49 (0) 331-5509-542
Hasso Plattner Institute for          Fax:    ++49 (0) 331-5509-229
Software Systems Engineering          http://www.swa.hpi.uni-potsdam.de/
Prof.-Dr.-Helmert-Str. 2-3, D-14482 Potsdam, Germany

Hasso-Plattner-Institut für Softwaresystemtechnik GmbH, Potsdam
Amtsgericht Potsdam, HRB 12184
Geschäftsführung: Prof. Dr. Christoph Meinel

Aaron Gray | 27 Apr 23:15

idc for windows platform

Hi,
 
Just signed onto fonc mailing list and am also in early stages of looking at MS VC porting of idc.
 
Basically your going to have to do a #ifdef for the MS platforms.
 
you need a comma and also a __VA_ARGS__ rather than a ##ARG, something like :-
 
#ifndef _MSC_VER
 
  #define _send(MSG, RCV, ARG...) ({     \
    register oop _r= (RCV);      \
    struct __closure *_c= (struct __closure *)_libid->bind((MSG), _r); \
    (_c->method)((oop)_c, _r, _r, ##ARG);     \
  })
 
#else
 
  #define _send(MSG, RCV, ...) ({     \
    register oop _r= (RCV);      \
    struct __closure *_c= (struct __closure *)_libid->bind((MSG), _r); \
    (_c->method)((oop)_c, _r, _r, __VA_ARGS__);     \
  })
 
#endif
 
Watch out for wrapped lines :)
 
I have not tried the above as of yet but it should work.
 
Aaron   
<div>
<div>
<div>Hi,</div>
<div>&nbsp;</div>
<div>Just signed onto&nbsp;fonc mailing list and am also 
in early stages of looking at MS VC porting of idc.</div>
<div>&nbsp;</div>
<div>Basically your going to have to do a #ifdef for the 
MS platforms.</div>
<div>&nbsp;</div>
<div>you need a comma and also a __VA_ARGS__ rather than 
a ##ARG, something like :-</div>
<div>&nbsp;</div>
<div>#ifndef _MSC_VER</div>
<div>&nbsp;</div>
<div>&nbsp; #define _send(MSG, RCV, ARG...) 
({&nbsp;&nbsp;&nbsp;&nbsp; \<br>&nbsp;&nbsp;&nbsp; register oop _r= 
(RCV);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<br>&nbsp;&nbsp;&nbsp; struct __closure 
*_c= (struct __closure *)_libid-&gt;bind((MSG), _r); \<br>&nbsp;&nbsp;&nbsp; 
(_c-&gt;method)((oop)_c, _r, _r, ##ARG);&nbsp;&nbsp;&nbsp;&nbsp; \<br>&nbsp; 
})</div>
<div>&nbsp;</div>
<div>#else</div>
<div>&nbsp;</div>
<div>&nbsp; #define _send(MSG, RCV, ...) 
({&nbsp;&nbsp;&nbsp;&nbsp; \<br>&nbsp;&nbsp;&nbsp; register oop _r= 
(RCV);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \<br>&nbsp;&nbsp;&nbsp; struct __closure 
*_c= (struct __closure *)_libid-&gt;bind((MSG), _r); \<br>&nbsp;&nbsp;&nbsp; 
(_c-&gt;method)((oop)_c, _r, _r, __VA_ARGS__);&nbsp;&nbsp;&nbsp;&nbsp; 
\<br>&nbsp; })</div>
<div>&nbsp;</div>
<div>#endif</div>
<div>&nbsp;</div>
<div>Watch out for wrapped lines :)</div>
<div>&nbsp;</div>
<div>I have not tried the above as of yet but it should 
work.</div>
<div>&nbsp;</div>
<div>Aaron&nbsp;&nbsp;&nbsp; 
</div>
</div>
</div>
Felix Rabe | 20 Apr 17:10

Intro myself / General interest voicing / rant you can ignore

Hi VPRI,

I'm somebody programming too much for too long to be a conventional
Theology student, but that (Theology student) I am (unconventionally).

Since seeing Aza Raskin on Google Video a few times and since I got an
OLPC XO-1, I have recently been hooked into thinking about ways to make
computing fundamentally better.  I found out about your STEPS research
project over http://lwn.net/Articles/278531/ and am very interested in
your work.  It's as if I found the intersection between the hacker
culture and the top innovators.  I'm glad you got the resources to do
this important work; computing needs to stop being frustrating, slow,
limiting, ecological wasteful, complicated, etc.

I'm interested to have a closer look at your work and maybe (given I
have something valuable to say) contribute to it in some ways, given my
other priorities (learning Hebrew using the XO) allow me to do this.

For example, I just had a look at some of your published papers and
would like to have a closer look at your JavaScript + OMeta + IS system
and to try to understand it and give feedback and/or questions in some
way (mailing list).

Greetings,
Felix Rabe

Hi VPRI,

I'm somebody programming too much for too long to be a conventional
Theology student, but that (Theology student) I am (unconventionally).

Since seeing Aza Raskin on Google Video a few times and since I got an
OLPC XO-1, I have recently been hooked into thinking about ways to make
computing fundamentally better.  I found out about your STEPS research
project over http://lwn.net/Articles/278531/ and am very interested in
your work.  It's as if I found the intersection between the hacker
culture and the top innovators.  I'm glad you got the resources to do
this important work; computing needs to stop being frustrating, slow,
limiting, ecological wasteful, complicated, etc.

I'm interested to have a closer look at your work and maybe (given I
have something valuable to say) contribute to it in some ways, given my
other priorities (learning Hebrew using the XO) allow me to do this.

For example, I just had a look at some of your published papers and
would like to have a closer look at your JavaScript + OMeta + IS system
and to try to understand it and give feedback and/or questions in some
way (mailing list).

Greetings,
Felix Rabe

Michael FIG | 17 Apr 07:32
Favicon

jolt2: better jolt-burg compatibility

Hi,

The attached patch provides much better support for the jolt-burg
grammar features that aren't implemented in
function/jolt2/ColaGrammar.st.  Please reverse my last
jolt2-fixes.patch (if you applied it) before applying this one.

Inspired by OMeta, I added a new 'EXTENDS:' keyword (which can appear
after the grammar rules but before the optional start expression)
which allows you to import rules from another grammar.  The import
doesn't overwrite existing rules, and you can use EXTENDS: as many
times as you like.

With that established, I added a new ColaGrammar-derived grammar to
jolt2/boot.k that implements the missing features.  Reading that file
in conjunction with function/jolt2/ColaGrammar.st and the other
function/examples2 parsers should give you a good idea of how to use
jolt2's parsing features.  It should be possible to strip even more
out of ColaGrammar and put it into boot.k.  I'll leave that as an
exercise for the reader.

Maybe now would be a good time to update the Brainf*ck tutorial?

[Note that function/examples/peg still segfaults.  I haven't
investigated it yet, and I probably won't unless I'm really bored.]

Have fun,

-- 
Michael FIG <michael@...> //\
   http://michael.fig.org/    \//

Attachment (jolt2-fixes.patch): text/x-diff, 13 KiB
Hi,

The attached patch provides much better support for the jolt-burg
grammar features that aren't implemented in
function/jolt2/ColaGrammar.st.  Please reverse my last
jolt2-fixes.patch (if you applied it) before applying this one.

Inspired by OMeta, I added a new 'EXTENDS:' keyword (which can appear
after the grammar rules but before the optional start expression)
which allows you to import rules from another grammar.  The import
doesn't overwrite existing rules, and you can use EXTENDS: as many
times as you like.

With that established, I added a new ColaGrammar-derived grammar to
jolt2/boot.k that implements the missing features.  Reading that file
in conjunction with function/jolt2/ColaGrammar.st and the other
function/examples2 parsers should give you a good idea of how to use
jolt2's parsing features.  It should be possible to strip even more
out of ColaGrammar and put it into boot.k.  I'll leave that as an
exercise for the reader.

Maybe now would be a good time to update the Brainf*ck tutorial?

[Note that function/examples/peg still segfaults.  I haven't
investigated it yet, and I probably won't unless I'm really bored.]

Have fun,

--

-- 
Michael FIG <michael@...> //\
   http://michael.fig.org/    \//


Gmane