gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anonymous type completion error


From: Gaius Mulley
Subject: Re: Anonymous type completion error
Date: Sat, 18 May 2024 14:46:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

john o goyo <jog37@riddermarkfarm.ca> writes:

> Continuing with my last gm2-git and gm2-14.1.0, here is a small piece
> of the MCP3IO module from the Lilith compiler:
>
> MODULE partMCP3IO;
>
> TYPE Savepos;
>
>   MODULE OutputSystem;
>
>     EXPORT Savepos;
>
>     TYPE Savepos = CARDINAL;
>
>   END OutputSystem;
>
> END partMCP3IO.
>
>
> Original names left in.  Presumably this is valid PIM code as it is
> part of the Lilith compiler.  Gm2 reports the following error:
>
> partMCP3IO.mod:3:13: warning: In program module : syntax warning, missing
>     3 | TYPE Savepos;
>       |             ^
> partMCP3IO.mod:3:13: error: expecting one of:
> partMCP3IO.mod:17:1: error: no scope active: compilation failed

This looks very strange code, almost looks as if the TYPE at the top is
a forward declaration.  Normally that declaration in the definition
module indicates an opaque type.  I'm seeing a similar error message:

$ gm2 partMCP3IO.mod
partMCP3IO.mod:3:13: warning: In program module ‘partMCP3IO’: syntax warning, 
‘=’ missing 
    3 | TYPE Savepos;
      |             ^
partMCP3IO.mod:3:13: error: expecting one of: ‘PROCEDURE’ ‘POINTER’ ‘SET’ 
‘PACKEDSET’ ‘OF’ ‘RECORD’ ‘ARRAY’ ‘identifier’ ‘(’ ‘[’
partMCP3IO.mod:14:1: error: no scope active: compilation failed

>From my reading of the PIM2 grammar ebnf the above code would cause a
syntax error.  As the short form TYPE { ident [ "=" type ] ";" } is only
available in a definition module.  TypeDeclaration rule used in
program/implementation module (via the block rule) is: TypeDeclaration
is ident "=" type.

PIM3 and PIM4 are also the same.  Unless I've missed something?

I wonder whether this was a Lilith extension?

regards,
Gaius



reply via email to

[Prev in Thread] Current Thread [Next in Thread]