Thinking of creating a small mini-language-interpreter using Ruby

Always something I've wanted to write - an interpreter of my own. Now
I'm not likely to produce the next 'Ruby', but the recent announcement
of Fu's 'TAO', and other languages, make me wonder if I could write
something similar. Just for me, so to speak. A bit of fun.

I did look at the possibility of going down the traditional route of
[F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby.
Alright, it would be one interpreted language interpreting another,
but as I said, 'a bit of fun'. That's if two small children and a
scary wife allow me the time of course!!

I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
these in anger and are they complete/good-enough?

Has anybody done this kind of thing before? Not being a) a genius, b)
Matz, or c) the owner of a fine beard, can anybody recommend any good
URL's/tutorials/perhaps even books?

I could grow a beard of course...

···

--

All the best
Glenn
Aylesbury, UK

Always something I've wanted to write - an interpreter of my own. Now
I'm not likely to produce the next 'Ruby', but the recent announcement
of Fu's 'TAO', and other languages, make me wonder if I could write
something similar. Just for me, so to speak. A bit of fun.

I did look at the possibility of going down the traditional route of
[F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby.
Alright, it would be one interpreted language interpreting another,
but as I said, 'a bit of fun'. That's if two small children and a
scary wife allow me the time of course!!

I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
these in anger and are they complete/good-enough?

Has anybody done this kind of thing before? Not being a) a genius, b)
Matz, or c) the owner of a fine beard, can anybody recommend any good
URL's/tutorials/perhaps even books?

Brian Wisti just announced a new release of PageTemplate, you might
want to take a look at it.

I used an earlier version as a guide while building a mini language in
another (non Ruby) language. His code was easy to read, and it
covered the basics (looping, branching, etc.) I probably could have
built my own mini language without it, but his code definitely sped up
the process.

It's not using lex or yacc (or at least the old version wasn't), so it
may be too simplified for your needs, but that could also make it
easier to learn from.

  * http://rubyforge.org/projects/pagetemplate/
  * http://coolnamehere.com/products/pagetemplate/

I could grow a beard of course...

Yeah, they're mutually exclusive, as building a language/parser is
likely to cause you to want to tear some hair out :slight_smile:

···

On 5/1/05, Glenn Smith <glenn.ruby@gmail.com> wrote:

--

All the best
Glenn
Aylesbury, UK

--
Bill Guindon (aka aGorilla)

Glenn Smith wrote:

Always something I've wanted to write - an interpreter of my own. Now
I'm not likely to produce the next 'Ruby', but the recent announcement
of Fu's 'TAO', and other languages, make me wonder if I could write
something similar. Just for me, so to speak. A bit of fun.

I did look at the possibility of going down the traditional route of
[F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby. Alright, it would be one interpreted language interpreting another,
but as I said, 'a bit of fun'. That's if two small children and a
scary wife allow me the time of course!!

I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
these in anger and are they complete/good-enough?

Has anybody done this kind of thing before? Not being a) a genius, b)
Matz, or c) the owner of a fine beard, can anybody recommend any good
URL's/tutorials/perhaps even books?

I could grow a beard of course...

I wrote a small sequencing FSM language as a domain language in Ruby and then wrote a racc parser to convert from a simpler syntax to the ruby domain language. Racc takes a little bit to get used to but it works quite well and the runtime is included with every ruby install.

Charlie

I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
these in anger and are they complete/good-enough?

I've used racc before and its quite nice.

Has anybody done this kind of thing before? Not being
a) a genius

hardly that.

b) Matz

last time I checked I wasn't Matz. :slight_smile:

c) the owner of a fine beard

Oh well, 2 out of 3 :slight_smile:

I could grow a beard of course...

:slight_smile:

···

On 1-May-05, at 3:20 PM, Glenn Smith wrote:

Glenn

--
Jeremy Tregunna
jtregunna@blurgle.ca

"Glenn Smith" <glenn.ruby@gmail.com> schrieb im Newsbeitrag
news:e09ac119050501122011ecce08@mail.gmail.com...

Always something I've wanted to write - an interpreter of my own. Now
I'm not likely to produce the next 'Ruby', but the recent announcement
of Fu's 'TAO', and other languages, make me wonder if I could write
something similar. Just for me, so to speak. A bit of fun.

I did look at the possibility of going down the traditional route of
[F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby.
Alright, it would be one interpreted language interpreting another,
but as I said, 'a bit of fun'. That's if two small children and a
scary wife allow me the time of course!!

I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
these in anger and are they complete/good-enough?

Has anybody done this kind of thing before? Not being a) a genius, b)
Matz, or c) the owner of a fine beard, can anybody recommend any good
URL's/tutorials/perhaps even books?

I could grow a beard of course...

The beard might help - but OTOH how will your scary wife react to that?
Might turn the whole thing into a mission impossible...
:wink:

I haven't done this myself just a silly idea: when you compile your
language X right into Ruby code, then X might not be that slow during
execution because you save yourself one level of interpretation.

Kind regards

    robert

Glenn Smith wrote:

Always something I've wanted to write - an interpreter of my own. Now
I'm not likely to produce the next 'Ruby', but the recent announcement
of Fu's 'TAO', and other languages, make me wonder if I could write
something similar. Just for me, so to speak. A bit of fun.

I did look at the possibility of going down the traditional route of
[F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby. Alright, it would be one interpreted language interpreting another,
but as I said, 'a bit of fun'. That's if two small children and a
scary wife allow me the time of course!!

I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
these in anger and are they complete/good-enough?

Has anybody done this kind of thing before? Not being a) a genius, b)
Matz, or c) the owner of a fine beard, can anybody recommend any good
URL's/tutorials/perhaps even books?

I could grow a beard of course...

I played a bit with RACC but found the documentation a little terse so I wrote a quick description you may find of some small help.

  http://kvo.itee.uq.edu.au/twiki/bin/view/Main/RjBlog41

I think you'll find writing parsers in a YACC like system (e.g. RACC) a lot of fun. RACC is much easier to use to YACC/BISON.

regards,

Richard.

Ah - the hair is doing that on it's own!!

···

On 5/1/05, Bill Guindon <agorilla@gmail.com> wrote:

> I could grow a beard of course...

Yeah, they're mutually exclusive, as building a language/parser is
likely to cause you to want to tear some hair out :slight_smile:

"Glenn Smith" <glenn.ruby@gmail.com> schrieb im Newsbeitrag
news:e09ac119050501122011ecce08@mail.gmail.com...
> Always something I've wanted to write - an interpreter of my own. Now
> I'm not likely to produce the next 'Ruby', but the recent announcement
> of Fu's 'TAO', and other languages, make me wonder if I could write
> something similar. Just for me, so to speak. A bit of fun.
>
> I did look at the possibility of going down the traditional route of
> [F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby.
> Alright, it would be one interpreted language interpreting another,
> but as I said, 'a bit of fun'. That's if two small children and a
> scary wife allow me the time of course!!
>
> I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
> these in anger and are they complete/good-enough?
>
> Has anybody done this kind of thing before? Not being a) a genius, b)
> Matz, or c) the owner of a fine beard, can anybody recommend any good
> URL's/tutorials/perhaps even books?
>
> I could grow a beard of course...

The beard might help - but OTOH how will your scary wife react to that?
Might turn the whole thing into a mission impossible...
:wink:

I haven't done this myself just a silly idea: when you compile your
language X right into Ruby code, then X might not be that slow during
execution because you save yourself one level of interpretation.

Or even better, do like GCC and have switchable 'back-ends' that
generate for different execution environments ( ruby, python, perl,
java ) etc. :slight_smile:

···

On 5/2/05, Robert Klemme <bob.news@gmx.net> wrote:

Kind regards

   robert

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

Excellent Richard, thanks!!

···

On 5/3/05, Richard Cole <rcole@itee.uq.edu.au> wrote:

Glenn Smith wrote:

>Always something I've wanted to write - an interpreter of my own. Now
>I'm not likely to produce the next 'Ruby', but the recent announcement
>of Fu's 'TAO', and other languages, make me wonder if I could write
>something similar. Just for me, so to speak. A bit of fun.
>
>I did look at the possibility of going down the traditional route of
>[F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby.
>Alright, it would be one interpreted language interpreting another,
>but as I said, 'a bit of fun'. That's if two small children and a
>scary wife allow me the time of course!!
>
>I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
>these in anger and are they complete/good-enough?
>
>Has anybody done this kind of thing before? Not being a) a genius, b)
>Matz, or c) the owner of a fine beard, can anybody recommend any good
>URL's/tutorials/perhaps even books?
>
>I could grow a beard of course...
>
>
I played a bit with RACC but found the documentation a little terse so I
wrote a quick description you may find of some small help.

  http://kvo.itee.uq.edu.au/twiki/bin/view/Main/RjBlog41

I think you'll find writing parsers in a YACC like system (e.g. RACC) a
lot of fun. RACC is much easier to use to YACC/BISON.

regards,

Richard.

--

All the best
Glenn
Aylesbury, UK

Sounds like I need to craft a "Richard Stallman" style beard then!!

···

On 5/2/05, Lyndon Samson <lyndon.samson@gmail.com> wrote:

On 5/2/05, Robert Klemme <bob.news@gmx.net> wrote:
>
> "Glenn Smith" <glenn.ruby@gmail.com> schrieb im Newsbeitrag
> news:e09ac119050501122011ecce08@mail.gmail.com...
> > Always something I've wanted to write - an interpreter of my own. Now
> > I'm not likely to produce the next 'Ruby', but the recent announcement
> > of Fu's 'TAO', and other languages, make me wonder if I could write
> > something similar. Just for me, so to speak. A bit of fun.
> >
> > I did look at the possibility of going down the traditional route of
> > [F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby.
> > Alright, it would be one interpreted language interpreting another,
> > but as I said, 'a bit of fun'. That's if two small children and a
> > scary wife allow me the time of course!!
> >
> > I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
> > these in anger and are they complete/good-enough?
> >
> > Has anybody done this kind of thing before? Not being a) a genius, b)
> > Matz, or c) the owner of a fine beard, can anybody recommend any good
> > URL's/tutorials/perhaps even books?
> >
> > I could grow a beard of course...
>
> The beard might help - but OTOH how will your scary wife react to that?
> Might turn the whole thing into a mission impossible...
> :wink:
>
> I haven't done this myself just a silly idea: when you compile your
> language X right into Ruby code, then X might not be that slow during
> execution because you save yourself one level of interpretation.
>
Or even better, do like GCC and have switchable 'back-ends' that
generate for different execution environments ( ruby, python, perl,
java ) etc. :slight_smile:

> Kind regards
>
> robert
>
>

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

--

All the best
Glenn
Aylesbury, UK

He'd slay us for top-posting :slight_smile:

···

On 5/2/05, Glenn Smith <glenn.ruby@gmail.com> wrote:

Sounds like I need to craft a "Richard Stallman" style beard then!!

On 5/2/05, Lyndon Samson <lyndon.samson@gmail.com> wrote:
> On 5/2/05, Robert Klemme <bob.news@gmx.net> wrote:
> >
> > "Glenn Smith" <glenn.ruby@gmail.com> schrieb im Newsbeitrag
> > news:e09ac119050501122011ecce08@mail.gmail.com...
> > > Always something I've wanted to write - an interpreter of my own. Now
> > > I'm not likely to produce the next 'Ruby', but the recent announcement
> > > of Fu's 'TAO', and other languages, make me wonder if I could write
> > > something similar. Just for me, so to speak. A bit of fun.
> > >
> > > I did look at the possibility of going down the traditional route of
> > > [F]Lex/Yacc[Bison] and 'C', but it would be nice to write it in Ruby.
> > > Alright, it would be one interpreted language interpreting another,
> > > but as I said, 'a bit of fun'. That's if two small children and a
> > > scary wife allow me the time of course!!
> > >
> > > I see there are ruby-lex and ruby-yacc modules on RAA - anybody used
> > > these in anger and are they complete/good-enough?
> > >
> > > Has anybody done this kind of thing before? Not being a) a genius, b)
> > > Matz, or c) the owner of a fine beard, can anybody recommend any good
> > > URL's/tutorials/perhaps even books?
> > >
> > > I could grow a beard of course...
> >
> > The beard might help - but OTOH how will your scary wife react to that?
> > Might turn the whole thing into a mission impossible...
> > :wink:
> >
> > I haven't done this myself just a silly idea: when you compile your
> > language X right into Ruby code, then X might not be that slow during
> > execution because you save yourself one level of interpretation.
> >
> Or even better, do like GCC and have switchable 'back-ends' that
> generate for different execution environments ( ruby, python, perl,
> java ) etc. :slight_smile:
>
> > Kind regards
> >
> > robert
> >
> >
>
> --
> Into RFID? www.rfidnewsupdate.com Simple, fast, news.
>
>

--

All the best
Glenn
Aylesbury, UK

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

Lyndon Samson <lyndon.samson@gmail.com> writes:

···

On 5/2/05, Glenn Smith <glenn.ruby@gmail.com> wrote:

Sounds like I need to craft a "Richard Stallman" style beard then!!

He'd slay us for top-posting :slight_smile:

Well, Emacs with gnus can deuglify "Outlook" posts, which also inverts
top-quotes. :slight_smile:

(Yes, I know that rms uses RMAIL.)

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org