gm2
[Top][All Lists]
Advanced

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

Re: Anonymous type completion error


From: john o goyo
Subject: Re: Anonymous type completion error
Date: Sat, 18 May 2024 10:13:43 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 2024-05-18 09:46, Gaius Mulley wrote:
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?

I think this is an extension.  Prof Wirth himself said to follow the report and not their compiler (or something similar).

Sincerely,
john


regards,
Gaius




reply via email to

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