[M3devel] Modula-2 parsing
Rodney M. Bates
rodney_bates at lcwb.coop
Tue Aug 4 20:18:15 CEST 2015
On 08/04/2015 02:36 AM, Jay K wrote:
> Procedure.m3:
>
> Do we need this?
> I know it isn't much, but remove it?
>
>
> ELSIF (cur.token = TK.tSEMI) THEN
> t.body := NEW (Body, self := t);
> ProcBody.Push (t.body);
> (* try accepting the Modula-2 syntax *)
> Error.ID (id, "expecting \'=\' before procedure body");
> GetToken (); (* ; *)
> t.syms := Scope.PushNew (TRUE, id);
> t.block := BlockStmt.Parse (FALSE);
> t.fails := BlockStmt.ExtractFails (t.block);
> t.end_origin := Scanner.offset;
> final_id := MatchID ();
> IF (final_id # id) THEN
> Error.ID (id, "Initial name doesn\'t match final name");
> END;
> Scope.PopNew ();
> ProcBody.Pop ();
> ELSE
>
>
> It always errors?
>
> But I guess it errors and checks nicer than it might otherwise?
>
> Why am I looking here?
>
> Tangential:
>
> I'm looking for where/how to model counting TRYs per "procedure"
> and doing the alloca at the start of a "procedure".
>
>
> "procedure"'s definition for my context is being worked on.
> It appears to be three things:
> 1) Things called "PROCEDURE".
> 2) FINALLY blocks, sometimes
> 3) "Module main"
>
> I was looking for what they have in common already,
> and it looks like maybe "ProcBody.Push".
>
> So I was looking all of them.
>
> - Jay
>
>
>
>
> _______________________________________________
> M3devel mailing list
> M3devel at elegosoft.com
> https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel
>
--
Rodney Bates
rodney.m.bates at acm.org
More information about the M3devel
mailing list