Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Defining syntactic macros in interpreter
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
andris  
View profile  
 More options Nov 2, 7:30 am
From: andris <and...@seznam.cz>
Date: Mon, 2 Nov 2009 04:30:28 -0800 (PST)
Local: Mon, Nov 2 2009 7:30 am
Subject: Defining syntactic macros in interpreter
Hi, is that any possible?

I tried the example from web (0.9.1. release notes) with booish and
this is the result

CONSOLE
Welcome to booish, an interactive interpreter for the boo programming
language.
Running boo 0.9.2.3383 on CLR 2.0.50727.3603.

Enter boo code in the prompt below (or type /help).

>>>macro repeatLines(repeatCount as int, lines as string*):

...        for line in lines:
...                for i in range(repeatCount):
...                        print line
...
----^
ERROR: Unknown identifier: 'match'.
----^
ERROR: Unknown identifier: 'case'.
----------------------^
ERROR: Unknown identifier: 'repeatCount'.
----^
ERROR: Unknown identifier: '_'.
----^
ERROR: Target of explode expression must be an array.
-----------------------------------^
ERROR: Unknown identifier: 'repeatCount'.
----^
ERROR: Unknown identifier: 'otherwise'.

ENDCONSOLE

Similar trouble, when passing the macro code to
InteractiveInterpreter2.Eval() (newlines and tabs are used in the
passed string to indent the same way as above)

input12(1,1): BCE0005: Boo.Lang.Compiler.CompilerError: Unknown
identifier: 'macro'.
input12(1,7): BCE0005: Boo.Lang.Compiler.CompilerError: Unknown
identifier: 'repeatLines'.
input12(1,19): BCE0005: Boo.Lang.Compiler.CompilerError: Unknown
identifier: 'repeatCount'.
input12(1,34): BCE0006: Boo.Lang.Compiler.CompilerError: 'int' is a
value type. The 'as' operator can only be used with reference types.
input12(1,39): BCE0005: Boo.Lang.Compiler.CompilerError: Unknown
identifier: 'lines'.
input12(2,17): BCE0005: Boo.Lang.Compiler.CompilerError: Unknown
identifier: 'lines'.
input12(3,24): BCE0005: Boo.Lang.Compiler.CompilerError: Unknown
identifier: 'repeatCount'.

To make the second approach function (using Eval()) would be awesome.

Thanks


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rodrigo B. de Oliveira  
View profile  
 More options Nov 2, 7:38 am
From: "Rodrigo B. de Oliveira" <rodrigobam...@gmail.com>
Date: Mon, 2 Nov 2009 04:38:51 -0800
Local: Mon, Nov 2 2009 7:38 am
Subject: Re: Defining syntactic macros in interpreter

On Mon, Nov 2, 2009 at 4:30 AM, andris <and...@seznam.cz> wrote:

> Hi, is that any possible?

Yes.

Yeah, that's annoying. You have to "import Boo.Lang.PatternMatching"
before defining the macro. We'll fix that for the next release.

Best,
Rodrigo


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
andris  
View profile  
 More options Nov 2, 8:52 am
From: andris <and...@seznam.cz>
Date: Mon, 2 Nov 2009 05:52:00 -0800 (PST)
Subject: Re: Defining syntactic macros in interpreter

> Yeah, that's annoying. You have to "import Boo.Lang.PatternMatching"
> before defining the macro. We'll fix that for the next release.

Great, that worked for booish.exe.

When using InteractiveInterpreter2.Eval() I still can't define any
macro, the errors are same as mentioned above.

InteractiveInterpreter2 interpreter = new InteractiveInterpreter2();
interpreter.Eval("load(\"Boo.Lang.PatternMatching.dll\")");
interpreter.Eval("import Boo.Lang.PatternMatching");
interpreter.Eval("macro repeatLines(repeatCount as int, lines as
string*):\n" +
                        "  for line in lines:\n" +
                        "          for i in range(repeatCount):\n" +
                        "                  print line\n");

is what I do in C#

Could there be something missing yet?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
andris  
View profile  
 More options Nov 2, 6:01 pm
From: andris <and...@seznam.cz>
Date: Mon, 2 Nov 2009 15:01:01 -0800 (PST)
Local: Mon, Nov 2 2009 6:01 pm
Subject: Re: Defining syntactic macros in interpreter

>When using InteractiveInterpreter2.Eval() I still can't define any
>macro, the errors are same as mentioned above.

That was solved automagically, I have no idea what was wrong, but
after I turned PC on again, it started to work ;)
Sorry, thanks

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google