I am receiving a blank compilation error.

23 views
Skip to first unread message

Mostafa Shokrof

unread,
Oct 20, 2019, 2:48:19 AM10/20/19
to Boa Language and Infrastructure User Forum
I am trying to run this code, It can't be compiled and the status is just "Error" without any help messages.


Code: 
# Counting the number of revisions for all Java projects with SVN
p: Project = input;
majorCommitersHistogram: output sum[int] of int;
minorCommitersHistogram: output sum[int] of int;



majorCommiters : int;
minorCommiters : int;

majorThreshold : int;

numCommiters: int;
committers: map[string] of int;
numCommitsPerCommitter: array of int;

visit(p, visitor {
    before node: Revision -> {
        committers[node.author.username]++;
    }
    after node: CodeRepository -> {
        majorThreshold = int(float( len(node.revisions) )*0.05);
        
        
        #majorCommiters =0;
        #minorCommiters =0;
                
        numCommitsPerCommitter = values(committers);
        
                
        for(i:=0 ; i < len(numCommitsPerCommitter) ; i++)
        {
            if(numCommitsPerCommitter[i]>=majorThreshold)
            {
                majorCommiters++;
            }
            else
            {
                minorCommiters++;
            }
        }
                
        majorCommitersHistogram[majorCommiters] << 1;
        minorCommitersHistogram[minorCommiters] << 1;
        stop;
    }
});


Thanks in advance,
Mostafa

Robert Dyer

unread,
Oct 20, 2019, 9:26:03 AM10/20/19
to boa-...@googlegroups.com
Hi Mostafa,

Would you mind filing this as a bug on GitHub?


I can tell you right now, it is the line 'committers[node.author.username]++;’ and a simple work around is to change that line to this:

committers[node.author.username] = committers[node.author.username] + 1;

Apparently ‘++’ (and I assume ‘—‘) were never tested on non-basic types (maps/sets/arrays/etc).

- Robert

--
More information about Boa: http://boa.cs.iastate.edu/
---
You received this message because you are subscribed to the Google Groups "Boa Language and Infrastructure User Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to boa-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/boa-user/bb11bd6f-67be-42ee-a030-65d092e12dbb%40googlegroups.com.

________________________________________________
Robert Dyer | Assistant Professor | Department of Computer Science
BGSU | rd...@bgsu.edu | 419.372.3469 | 244 Hayes | Bowling Green, OH
pronouns: he/him/his

ACM SIGSOFT Executive Committee, Secretary/Treasurer

Need help generating benchmarks for your program analysis tools?
Check out PAClabhttps://paclab.cs.bgsu.edu/

Want to mine ultra-large-scale software repositories with minimal initial
investment? Check out Boa! http://boa.cs.iastate.edu/

Robert Dyer

unread,
Oct 20, 2019, 10:21:46 AM10/20/19
to boa-...@googlegroups.com
Actually I just realized, the fix I suggested could hit a runtime error as the first time the key isn’t in the map.  This is a better fix:

committers[node.author.username] = 1 + lookup(committers, node.author.username, 0);

Finally once we fix that error, you have another error:

- you can’t do ’stop’ in an after visitor clause - stop only works in before clauses. Just remove that line

This code works:


- Robert

Mostafa Shokrof

unread,
Oct 20, 2019, 3:46:15 PM10/20/19
to boa-...@googlegroups.com
Hi Robert,
Thanks for the fast reply and for solving my problem. I submitted a bug on github(https://github.com/boalang/compiler/issues/259).

--
More information about Boa: http://boa.cs.iastate.edu/
---
You received this message because you are subscribed to the Google Groups "Boa Language and Infrastructure User Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to boa-user+u...@googlegroups.com.


--
Moustafa Shokrof

Reply all
Reply to author
Forward
0 new messages