Re: Reimplementing Bertrand

26 views
Skip to first unread message
Message has been deleted

wm

unread,
Jan 10, 2009, 12:30:50 AM1/10/09
to bertrand-...@googlegroups.com


---------- Forwarded message ----------
From: wm <wmle...@gmail.com>
Date: Jan 9, 12:26 pm
Subject: January meeting
To: WestsideProggers


> /me adds Wm to TO: of message in hopes of getting his attention

Attention gotten.

Have added some new examples to Bertrand, plus updated the
documentation.

I'm really looking for someone(s) who want to do some real work with
Bertrand, like adding array/streams/iterators to it. Or adding a
graphical user interface.

--wm

wm

unread,
Jan 10, 2009, 12:33:45 AM1/10/09
to bertrand-...@googlegroups.com


---------- Forwarded message ----------
From: "Phil Tomson" <philtom...@gmail.com>
Date: Jan 9, 12:34 pm
Subject: January meeting
To: WestsideProggers


On Fri, Jan 9, 2009 at 12:26 PM, wm <wmle...@gmail.com> wrote:

>> /me adds Wm to TO: of message in hopes of getting his attention
> Attention gotten.

> Have added some new examples to Bertrand, plus updated the
> documentation.

> I'm really looking for someone(s) who want to do some real work with
> Bertrand, like adding array/streams/iterators to it. Or adding a
> graphical user interface.

> --wm

What about Bertrand as an embedded DSL within another language like
OCaml or Haskell?  then you'd get those things pretty much for free.

You can add syntax to OCaml, for example, using campl4 (Caml's
pre-processor that lets you manipulate the AST for a program and add
syntax).  That might be an interesting way to go.

Phil

wm

unread,
Jan 10, 2009, 12:34:09 AM1/10/09
to bertrand-...@googlegroups.com


---------- Forwarded message ----------
From: "Phil Tomson" <philtom...@gmail.com>
Date: Jan 9, 4:37 pm
Subject: January meeting
To: WestsideProggers


I've been looking for an excuse to play with camlp4.  Let me look at
Bertrand a bit more (I just took a quick glance at it  a month or so
ago when Igal posted the code) and see what it would take.  From what
you said in the Nov meeting there isn't much syntax to Bertrand.

Phil

On Fri, Jan 9, 2009 at 4:29 PM, wm <wmle...@gmail.com> wrote:

> I would certainly be involved, if others will jump in too.

wm

unread,
Jan 10, 2009, 12:34:41 AM1/10/09
to bertrand-...@googlegroups.com


---------- Forwarded message ----------
From: Wm Leler <wmle...@gmail.com>
Date: Jan 9, 4:56 pm
Subject: January meeting
To: WestsideProggers


There is almost no syntax to Bertrand, just rules, types, and
operators.
Only seven reserved characters in Bertrand, which are { } . # " ' `
Extremely simple semantics, too.

I don't know camlp4. Do you have a pointer to a good quick
introduction?

It would be very good to embed Bertrand in some other language, but it
 
would need to be the right language.

--wm

wm

unread,
Jan 10, 2009, 12:38:24 AM1/10/09
to bertrand-...@googlegroups.com


---------- Forwarded message ----------
From: "Phil Tomson" <philtom...@gmail.com>

Date: Jan 9, 5:22 pm
Subject: January meeting
To: WestsideProggers


On Fri, Jan 9, 2009 at 4:56 PM, Wm Leler <wmle...@gmail.com> wrote:

> There is almost no syntax to Bertrand, just rules, types, and operators.
> Only seven reserved characters in Bertrand, which are { } . # " ' `
> Extremely simple semantics, too.

> I don't know camlp4. Do you have a pointer to a good quick introduction?

There's a wiki here:http://brion.inria.fr/gallium/index.php/Camlp4

There's a new blog about it here:http://
ambassadortothecomputers.blogspot.com/

Here's an example where they wrote a camlp4 syntax extension that
generates converters between OCaml and JSON:http://
martin.jambon.free.fr/json-static.html

> It would be very good to embed Bertrand in some other language, but it
> would need to be the right language.

What do you think would be the characteristics of the 'right'
language?

Phil

wm

unread,
Jan 10, 2009, 12:38:43 AM1/10/09
to bertrand-...@googlegroups.com


---------- Forwarded message ----------
From: Wm Leler <wmle...@gmail.com>

Date: Jan 9, 5:38 pm
Subject: January meeting
To: WestsideProggers

>> It would be very good to embed Bertrand in some other language, but  
>> it
>> would need to be the right language.

> What do you think would be the characteristics of the 'right'  
> language?

> Phil

Off the top of my head:

1) It should be very good at manipulating tree structures efficiently.
 
Most of what Bertrand does is match a pattern expression against a  
subject expression, and replace it with a body expression. Over and  
over again.

2) It should be able to define new functions at run-time and evaluate
 
them.

3) It would be nice if it could deal with infix notation expressions.

4) It should have some built-in graphics.

5) It should run on lots of platforms, and be widely available.

I'm sure there are other things too.

--wm

wm

unread,
Jan 10, 2009, 12:39:17 AM1/10/09
to bertrand-...@googlegroups.com


---------- Forwarded message ----------
From: "Phil Tomson" <philtom...@gmail.com>

Date: Jan 9, 6:21 pm
Subject: January meeting
To: WestsideProggers


On Fri, Jan 9, 2009 at 5:38 PM, Wm Leler <wmle...@gmail.com> wrote:

>> What do you think would be the characteristics of the 'right'
>> language?

>> Phil

> Off the top of my head:

> 1) It should be very good at manipulating tree structures efficiently.
> Most of what Bertrand does is match a pattern expression against a
> subject expression, and replace it with a body expression. Over and
> over again.

Both Haskell and OCaml are great for tree manipulation.

> 2) It should be able to define new functions at run-time and evaluate
> them.

...that's a bit tougher.  Neither is a very dynamic language.  Could
you generate expression trees that then get evaluated within a
context?

> 3) It would be nice if it could deal with infix notation expressions.

Should work.

> 4) It should have some built-in graphics.

They've each got bindings to graphics libs.

> 5) It should run on lots of platforms, and be widely available.

All the important platforms are covered (not sure about Windows,
though ;-)

Phil

wm

unread,
Jan 10, 2009, 12:42:56 AM1/10/09
to bertrand-...@googlegroups.com

wm

unread,
Jan 10, 2009, 12:47:37 AM1/10/09
to Bertrand Constraint Programming Language
> Both Haskell and OCaml are great for tree manipulation.
Great, because C kinda sucks at that!

> > 2) It should be able to define new functions at run-time and evaluate
> > them.
>
> ...that's a bit tougher.  Neither is a very dynamic language.  Could
> you generate expression trees that then get evaluated within a
> context?
Hmmm. Maybe. Actually, currently Bertrand doesn't need to define new
functions, but I always wanted to be able to compile it, using a just-
in-time constraint compiler, and then execute the compiled
constraints, so all I really need is the ability to create expressions
and then evaluate them very quickly.

> > 3) It would be nice if it could deal with infix notation expressions.
>
> Should work.
Great!

>
> > 4) It should have some built-in graphics.
>
> They've each got bindings to graphics libs.
Hopefully for both input and output (for interactive graphics)

> > 5) It should run on lots of platforms, and be widely available.
>
> All the important platforms are covered (not sure about Windows,
> though ;-)
Windoze? What's that? :-)

--wm

wm

unread,
Jan 22, 2009, 7:09:31 PM1/22/09
to Bertrand Constraint Programming Language
Bart is suggesting Curry (which is based on Haskell but also includes
logic programming). That might be interesting.
http://en.wikipedia.org/wiki/Curry_(programming_language)

Phil Tomson

unread,
Jan 22, 2009, 7:15:02 PM1/22/09
to bertrand-...@googlegroups.com

I also see that ghc (popular Haskell compiler) now has something they
call "compiler plugins" which use template haskell (like camlp4, but
for Haskell), you can read an article about compiler plugins for ghc
in issue 12 of the Monad Reader:
http://www.haskell.org/haskellwiki/The_Monad.Reader
The article is entitled:
Compiler Development Made Easy

Phil

Phil Tomson

unread,
Jan 22, 2009, 7:16:06 PM1/22/09
to bertrand-...@googlegroups.com

If Curry uses ghc, then maybe that's how they do it? (via ghc plugins?)

Phil

Reply all
Reply to author
Forward
0 new messages