[Oberon] [EXT] Porting S3 / V4 Oberon (was: File transfer)

Skulski, Wojciech skulski at pas.rochester.edu
Sun Jan 3 17:45:09 CET 2021


>Another idea perhaps worth considering is not a new compiler, 
>but a scanner front end which will add commented warnings 
>to the code under V4. That is, the output will be the same 
>source file (with all the Elements and formatting!) with added lines like:

>I vaguely remember seeing beautifiers under BlackBox. 
>Perhaps there is one under V4/S3 as well?

There is an Analyzer available under V4. It can analyze and flag features. Perhaps this Analyzer can be modified to catch the obsolescent language features?

Here is the Analyzer.Tool under Linz V4:

------------------------------
Analyzer.Analyze *			Analyzer.Analyze *\ituvxs	full analysis
Analyzer.Analyze *\its		intermediate access, TB procs check, eval. seq.

Analyzer.Analyze (("*" | "@") ["\" opt] | {name ["\" opt]} "~" | "^")

Options (complementing each other):
i	redeclaration of/use of/assignment to intermediate items 
t     redefinition of or new definition of type bound procedures
u	used before set for different scopes
v	use of var parameters
x	use/initialization of exported items
s	evaluation sequence of function calls

Analyzer.Analyze marks by default
- all non-exported variables/constants/types/fields that are declared
	but never used, used before being initialized (*), never initialized,
	and initialized but never used.
- non-exported [type-bound] procedures that are never called.
- modules that are imported but never used.

(*) For variables declared in a different scope, no warning is
produced (see option \u, however).

\i(ntermediate) additionally marks
- items that are already declared in an outer scope.
- the use of or assignment to intermediate items (e.g. local
   variables/parameters declared in an outer scope).

\t(ype bound procedures) additionally marks
- the redefinition of type bound procedures.
- the new definition of type bound procedures in an extended type.

\u(sed) additionally marks
- 'used before set' for variables declared in a different scope.

\v(arpar) additionally marks
- variables that are used as var parameters and are therefore not
   ensured to be initialized.

\x (eXported) additionally marks
- exported items that are declared but not used by the module itself,
   used before being initialized, never initialized, and initialized but never
   used.

\s (evaluation Sequence) additionally marks
- calls of procedures with more than one parameter, where function
   calls occur in the parameter list. The evaluation sequence of
   parameters may affect the side effects of these functions.

Add the following to your OberonErrors.Text.

3.5 Analyzer Warnings

900	never used
901	never set
902	used before set
903	set but never used
904	used as varpar, possibly not set
905	also declared in outer scope
906	access/assignment to intermediate
907	redefinition
908	new definition
909	statement after RETURN/EXIT
910	for loop variable set
911	implied type guard in record assignment


More information about the Oberon mailing list