[comp.lang.modula2] Continuation of previous letter

Cobus.Debeer@p0.f1.n491.z5.fidonet.org (Cobus Debeer) (07/27/90)

 
Hello: 
 
   With regard to the function without a RETURN statement, I believe that 
   both the compile-time error and the run-time error should occur.  In  
   keeping with the philosophy of M2, the compiler is 'strict' and should 
   not accept dubious code or code that is obviously incorrect, like  
   function procedures that don't return values.  The existense of one or 
   more RETURN statements does not guarentee that all possible points of 
   of return from the procedure returns a value and this must be caught at 
   run-time.  See the following : 
      PROCEDURE Error () : INTEGER; 
      BEGIN 
         IF Condition1 THEN 
            ... 
            RETURN 1; 
         ELSIF Condition2 THEN 
            Code; MoreCode; 
         END; 
      END Error; 
   There is at least two ways in which the procedure can end without a RETURN 
   statement. 
 
  With regards to differences between the JPI compiler and PIM2, I have  
  experienced the following difference in the worst possible way.  In a def 
  file I wrote : 
 
  DEFINITION MODULE RegExp; 
 
  PROCEDURE PosNL( Source, Pat  : ARRAY OF CHAR; VAR Len :     
          CARDINAL; OccurrenceNo : CARDINAL ) : CARDINAL; 
  END RegExp. 
 
  IMPLEMENTATION MODULE RegExp; 
 
  PROCEDURE PosNL( Source, Pat  : ARRAY OF CHAR; VAR Len :     
          CARDINAL; StartFrom : CARDINAL ) : CARDINAL; 
  BEGIN .. END PosNL; 
 
  etc 
  END RegExp. 
 
  After writing the implementation of the function as declared in the def  
  and using it I changed my mind as to how it should work and I changed the  
  implementation and the name of the last parameter.  Later I re-used the 
  code and nearly lost my sanity ...  The compiler should not just count the 
  parameters and check their types, it must also check that the names of the 
  parameters are identical as declared in the definition and implementation  
  parts.  Just imagine what will happen in a multi-programmer project where  
  the DEF files are the only part available to the implementer of other  
  modules ( as it should be ).  The old V2 Logitec compiler got this right. 
 
  I would love to get hold of a new release of your libraries that use 
  assembler pieces as the versions that I have is now broken due to the new 
  release of the compiler.  If you ever need regular expression matching 
  code, I have a working matcher which I will make available to anybody 
  who offers something in return ( or who asks nicely ) but I am not willing 
  to put the source on a bulletin board. 
 
  Do you know if a YACC / LEX equivilent tool exists for M2 ie. something that 
  produces M2 as output from a grammer as input ? 
 
  Regards 
  Cobus de Beer 
 
 
 


--  
uucp: uunet!m2xenix!puddle!5!491!1.0!Cobus.Debeer
Internet: Cobus.Debeer@p0.f1.n491.z5.fidonet.org

Peter.M..Perchansky@f101.n273.z1.fidonet.org (Peter M. Perchansky) (07/30/90)

Hello:

    I have yet to recode my assembly modules to work with 2.00; it is a headache; but I have redone all of my library modules (some only had to be recompiled) to work with 2.00.

    Where is the Golden City BBS?  If it is in the states, I may be able to upload my library modules.

    Sorry, I do not know of a lex/yacc for M2.



--  
uucp: uunet!m2xenix!puddle!273!101!Peter.M..Perchansky
Internet: Peter.M..Perchansky@f101.n273.z1.fidonet.org