commit - 4b0bcc854725c71590df2786768009a5bf26027e
commit + 64b0e82ab315572742f93f9789c5c6d16e4c4607
blob - aee9628bdfde43a9f21d2d3e91ce6d3567462693
blob + e10d1a674f97709eff162ea5de14204ed0528770
--- cc/cc1/cc1.c
+++ cc/cc1/cc1.c
enum dtype_type type;
};
+enum decl_type {
+ DL_VAR,
+ DL_FUNC,
+};
+
+struct decl {
+ struct decl *next;
+ enum sc_class sc;
+ struct dtype *dt;
+ char *name;
+};
+
// PARSER
+#define new(T) ((T *)calloc (1, sizeof (T)))
+#define pnew(T) (new (T))
+
dtype (dt)
struct dtype *dt;
{
}
}
+body ();
+
decl (global)
{
enum sc_class sc;
if (!first || !global)
error ("syntax error");
- // TODO: body
+ body ();
expect ('}');
return 1;
return 1;
}
+body (void)
+{
+ while (decl (0));
+
+}
+
parse (void)
{
while (peek () != TK_EOF) {
blob - 5214b99bdcf8c37d707fd52884a8398dee10d032
blob + 9ca5ba4182db216e139a91acce1b53cc6a63b8f8
--- cc/cc1/test.c
+++ cc/cc1/test.c
int
g ()
{
+ extern x, y, z ();
+ int k;
}
main ()