I was able to get better messages out of the parser by changing the
exception handler.  It seems that the version of python (2.4.6)
installed at Wisconsin doesn't like the way it's currently handled.
If you change the yacc.parse call to:

try:
   results = yacc.parse(file(filename, 'r').read()
except (ParseError, TokenError), e:
   print "File ",filename," ",e
   raise e

You get much more helpful output.  It seems the problem is trying to
raise type(e) rather than just e itself.   Anyone know why this would
be?

-Derek

On Mon, Aug 3, 2009 at 2:39 PM, Derek Hower<derek.ho...@gmail.com> wrote:
> Just remove a semicolon from an action statement.
>
> GEM5 prints
>
> TypeError: exceptions must be classes, instances, or strings
> (deprecated), not type:
>  File "/afs/cs.wisc.edu/p/multifacet/users/drh5/gem5/SConstruct", line 898:
>    exports = 'env')
>  File 
> "/s/scons-1.1.0/amd64_rhel5/lib/scons-1.1.0.d20081207/SCons/Script/SConscript.py",
> line 612:
>    return apply(method, args, kw)
>  File 
> "/s/scons-1.1.0/amd64_rhel5/lib/scons-1.1.0.d20081207/SCons/Script/SConscript.py",
> line 549:
>    return apply(_SConscript, [self.fs,] + files, subst_kw)
>  File 
> "/s/scons-1.1.0/amd64_rhel5/lib/scons-1.1.0.d20081207/SCons/Script/SConscript.py",
> line 259:
>    exec _file_ in call_stack[-1].globals
>  File 
> "/afs/cs.wisc.edu/p/multifacet/users/drh5/gem5/build/ALPHA_SE/SConscript",
> line 252:
>    SConscript(joinpath(root, 'SConscript'), build_dir=build_dir)
>  File 
> "/s/scons-1.1.0/amd64_rhel5/lib/scons-1.1.0.d20081207/SCons/Script/SConscript.py",
> line 612:
>    return apply(method, args, kw)
>  File 
> "/s/scons-1.1.0/amd64_rhel5/lib/scons-1.1.0.d20081207/SCons/Script/SConscript.py",
> line 549:
>    return apply(_SConscript, [self.fs,] + files, subst_kw)
>  File 
> "/s/scons-1.1.0/amd64_rhel5/lib/scons-1.1.0.d20081207/SCons/Script/SConscript.py",
> line 259:
>    exec _file_ in call_stack[-1].globals
>  File 
> "/afs/cs.wisc.edu/p/multifacet/users/drh5/gem5/build/ALPHA_SE/mem/protocol/SConscript",
> line 82:
>    hh, cc = scan([s.srcnode().abspath for s in sm_files])
>  File 
> "/afs/cs.wisc.edu/p/multifacet/users/drh5/gem5/src/mem/slicc/parser/parser.py",
> line 547:
>    raise type(e), tuple([filename] + [ i for i in e ])
>
> Where GEMS would print
>
> ../protocols/MOESI_CMP_directory-L1cache.sm:483: syntax error,
> unexpected IDENT at out_msg
> make[1]: *** [generated/MOESI_CMP_directory_m/generated] Error 1
> make[1]: Leaving directory `/afs/cs.wisc.edu/u/d/r/drh5/gems-2.0/ruby'
>
> Which doesn't exactly say "you're missing a semicolon," but at least
> points you to the right file and line.
>
> -Derek
>
>
> On Mon, Aug 3, 2009 at 2:29 PM, nathan binkert<n...@binkert.org> wrote:
>>> I should point out that I've also run in to this problem, and it is
>>> annoying enough that I'd really like to see it fixed sooner rather
>>> than later. Right now I usually have to copy my changes to GEMS and
>>> compile there to get useful error messages.
>> Can you give me an example of an error that I can introduce that
>> should give a better error message?  I can try this out and try to get
>> something in there that helps out.
>>
>>  Nate
>> _______________________________________________
>> m5-dev mailing list
>> m5-dev@m5sim.org
>> http://m5sim.org/mailman/listinfo/m5-dev
>>
>
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to