[ExM Users] multiple returns allowed in Swift/T

Ketan Maheshwari ketancmaheshwari at gmail.com
Wed Aug 7 20:45:18 CDT 2013


Yep, thanks. I added _outB4 to arg list which fixed it.


On Wed, Aug 7, 2013 at 8:36 PM, Tim Armstrong <tim.g.armstrong at gmail.com>wrote:

> I think the problem is _outB4, which is an undeclared variable.  This
> shouldn't result in a null pointer exception: I'll create a ticket to fix
> it and produce a more helpful error.
>
>  Tim
>
>
>
> On Wed, Aug 7, 2013 at 8:31 PM, Ketan Maheshwari <
> ketancmaheshwari at gmail.com> wrote:
>
>> Hi Tim,
>>
>> I made the change as you suggested but now I am getting java NPE:
>>
>> $ stc mimo.swift > mimo.tcl
>> STC INTERNAL ERROR
>> Please report this
>> java.lang.NullPointerException
>>     at exm.stc.frontend.ASTWalker.evalAppCmdArgs(ASTWalker.java:2431)
>>     at exm.stc.frontend.ASTWalker.genAppFunctionBody(ASTWalker.java:2188)
>>     at exm.stc.frontend.ASTWalker.compileAppFunction(ASTWalker.java:2155)
>>     at exm.stc.frontend.ASTWalker.walkTopLevelCompile(ASTWalker.java:327)
>>     at exm.stc.frontend.ASTWalker.walkTopLevel(ASTWalker.java:237)
>>     at exm.stc.frontend.ASTWalker.walkFile(ASTWalker.java:199)
>>     at exm.stc.frontend.ASTWalker.loadModule(ASTWalker.java:385)
>>     at exm.stc.frontend.ASTWalker.walk(ASTWalker.java:168)
>>     at exm.stc.ui.STCompiler.compile(STCompiler.java:76)
>>     at exm.stc.ui.Main.main(Main.java:93)
>>
>> The script is as below:
>>
>> import files;
>> import io;
>> import string;
>> import sys;
>>
>> app (file _outB1, file _outB2, file _outB3) A (file _inA1, file _inA2,
>> file _inA3){
>>     "mimo.sh" @_inA1 @_inA2 @_inA3 @_outB1 @_outB2 @_outB3 @_outB4;
>>     }
>>
>> main{
>>
>> file in_a1=input_file("sample.txt");
>> file in_a2=input_file("sample.txt");
>> file in_a3=input_file("sample.txt");
>> file in_a4=input_file("sample.txt");
>>
>> foreach i in [0:1]{
>>    string outb1=sprintf("/tmp/swift.work/outb1-%i.dat", i);
>>    string outb2=sprintf("/tmp/swift.work/outb2-%i.dat", i);
>>    string outb3=sprintf("/tmp/swift.work/outb3-%i.dat", i);
>>    string outb4=sprintf("/tmp/swift.work/outb4-%i.dat", i);
>>
>>    file o1 <outb1>;
>>    file o2 <outb2>;
>>    file o3 <outb3>;
>>    file o4 <outb4>;
>>
>>    (o1, o2, o3, o4) = A (in_a1, in_a2, in_a3, in_a4);
>>
>> }
>> }
>>
>> Thanks,
>> Ketan
>>
>>
>>
>> On Wed, Aug 7, 2013 at 8:06 PM, Tim Armstrong <tim.g.armstrong at gmail.com>wrote:
>>
>>> You can't declare variables inside a multiple return, you'll have to
>>> declare them first, then assign them in a separate statement.
>>>
>>> - Tim
>>>
>>>
>>> On Wed, Aug 7, 2013 at 8:03 PM, Ketan Maheshwari <
>>> ketancmaheshwari at gmail.com> wrote:
>>>
>>>>  Hi,
>>>>
>>>> I am writing some benchmark scripts. One of them is SIMO for single
>>>> input multiple output for which an app looks as follows:
>>>>
>>>> app (file _outB1, file _outB2, file _outB3, file _outB4) A (file _inA1){
>>>>     "simo.sh" @_inA1 @_outB1 @_outB2 @_outB3 @_outB4;
>>>> }
>>>>
>>>> Wondering if this is the right way to define multiple outputs to an app?
>>>>
>>>> I am getting error message when I call the app in main{} as follows:
>>>>
>>>> (file outb1 <outb1>, file outb2 <outb2>, file outb3 <outb3>, file outb4
>>>> <outb4>) = A (in_a);
>>>>
>>>> The error is:
>>>>
>>>> simo.swift l.22:9 mismatched input 'outb1' expecting RPAREN
>>>> simo.swift l.22:49 no viable alternative at input 'outb3'
>>>> simo.swift l.22:82 no viable alternative at input ')'
>>>> simo.swift l.22:86 mismatched input 'A' expecting GT
>>>> simo.swift l.24:0 mismatched input '}' expecting EOF
>>>> Error occurred during parsing.
>>>>
>>>> Thanks for suggestions to fix this.
>>>>
>>>> --
>>>> Ketan
>>>>
>>>>
>>>> _______________________________________________
>>>> ExM-user mailing list
>>>> ExM-user at lists.mcs.anl.gov
>>>> https://lists.mcs.anl.gov/mailman/listinfo/exm-user
>>>>
>>>>
>>>
>>
>>
>> --
>> Ketan
>>
>>
>


-- 
Ketan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/exm-user/attachments/20130807/87c651be/attachment.html>


More information about the ExM-user mailing list