On Mon, Dec 21, 2009 at 12:35 PM, nathan binkert <[email protected]> wrote: >> diff -r 8f73bf7c3c5e -r 5d3a90f0ef4c src/mem/slicc/parser.py >> --- a/src/mem/slicc/parser.py Sat Dec 12 14:37:14 2009 -0800 >> +++ b/src/mem/slicc/parser.py Sat Dec 12 14:37:14 2009 -0800 >> @@ -418,6 +416,10 @@ >> "param : type ident" >> p[0] = ast.FormalParamAST(self, p[1], p[2]) >> >> + def p_param__default(self, p): >> + "param : type ident '=' NUMBER" >> + p[0] = ast.FormalParamAST(self, p[1], p[2], p[4]) >> + >> # Idents and lists >> def p_idents__braced(self, p): >> "idents : '{' identx '}'" > > This syntax is getting odd. I'm not sure if it's worthing changing at > this point, but organic growth of a language can make it look ugly > over time.
I don't follow... are you complaining about the syntax we're introducing, or the way we're parsing it? In this particular case, the syntax seems straightforward to me, as we're just extending the state-machine parameter block to allow defaults, e.g., 'int buffer_size = 10'. There's a minor oddity in that the default value has to be an integer for now, regardless of the type of the parameter, but we can check that for consistency elsewhere. (Right now it falls through into the generated Python, so you won't get the type error until later than necessary.) We can extend it to allow more general defaults as needed. Steve _______________________________________________ m5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/m5-dev
