]> gcc.gnu.org Git - gcc.git/commit - gcc/m2/gm2-compiler/PHBuild.bnf
Bugfixes for default scope, tidying up of code and neater error messages.
authorGaius Mulley <gaius.mulley@southwales.ac.uk>
Sat, 25 Dec 2021 11:22:00 +0000 (11:22 +0000)
committerGaius Mulley <gaius.mulley@southwales.ac.uk>
Sat, 25 Dec 2021 11:22:00 +0000 (11:22 +0000)
commit966f05c85e437c04c9138c10a3c957888c21ee48
tree909d9df12823226a7ad798fd2d78a53a72c65040
parentc9afa63c3b00e843a703ae959000133a12fc4fcd
Bugfixes for default scope, tidying up of code and neater error messages.

gcc/m2/ChangeLog:

* m2/Make-lang.in (m2/gm2-compiler-boot/M2Error.o): New rule
to build M2Error.o using the --entended-opaque option since
M2Error.mod aggressively uses opaque data types.
* bnf/m2-1.bnf (DefProcedureHeading) ensure DefaultProcedure
scope is created before any further tokens are consumed.
Call LeaveErrorScope at the end of the rule.
* bnf/m2-2.bnf (DefProcedureHeading): Call LeaveErrorScope
at the end of the rule.
* bnf/m2-3.bnf (DefProcedureHeading): Call LeaveErrorScope
at the end of the rule.
* bnf/m2-c.bnf (DefProcedureHeading): Call LeaveErrorScope
at the end of the rule.
* bnf/m2-h.bnf (DefProcedureHeading): Call DefaultProcedure
and the beginning and LeaveErrorScope at the end of the rule.
* bnf/m2.bnf (DefProcedureHeading): Call DefaultProcedure
and the beginning of the rule.
* gm2-compiler/M2Comp.mod (M2Error): Import list replaced
identifiers ParsingComplete; and ResetErrorScope;.
* gm2-compiler/M2Error.def (NameKey): Renamed ParsingComplete to
ResetErrorScope.  Call ResetErrorScope before each pass commenses.
Import list replaced identifiers LeaveScope,
ParsingComplete by EnterErrorScope, ErrorScope,
GetCurrentErrorScope,
(LeaveErrorScope): New procedure.  (ResetErrorScope): New
procedure.  (LeaveScope) Removed.
* gm2-compiler/M2Error.mod (M2Options): Import StackOfAddress.
(printf2) Imported. (printf3) Imported.
(IsErrorScopeNul): New procedure function.
(GetAnnounceScope): Re-implementation.
(IsSameScope): New procedure function.
(AnnounceScope): Detect no scope.
(newErrorScope): Use scopeArray to push a new scope.
(DefaultProgramModule):  New implementation.
(DefaultImplementationModule): New implementation.
(DefaultDefinitionModule): New implementation.
(DefaultInnerModule): New implementation.
(GetCurrentErrorScope): New procedure function.
* gm2-compiler/M2MetaError.def: Extend the specifiers to
allow error contents to be pushed to a string stack;
string stack contents to be popped onto the output string;
replace dictionary string by the current output string and
remove all contents in the dictionary.
* gm2-compiler/M2MetaError.mod (addEntry) New procedure.
(killEntry) New procedure function.
(lookupDefine) New procedure function.
(lookupString) New procedure function.
(newEntry) New procedure function.
(popOutput) New procedure function.
(processDefine) New procedure.
(pushOutput) New procedure function.
(readWord) New procedure function.
(resetDictionary) New procedure.
(doErrorScopeMod) Enter error scope before
generate an error.
(doErrorScopeDef) Enter error scope before
generate an error.
(op): Handle 'Q', 'X', 'Y', 'Z' format directives.
* gm2-compiler/M2Scope.mod (SymbolTable): Import list includes
identifier GetErrorScope.
(enter): Re-implemented.
* gm2-compiler/M2StackWord.mod: Renamed data types so
they are easier to debug during bootstrap (avoid name clashes
with the M2StackAddress module).
* gm2-compiler/P0SymBuild.mod (EndProcedure): Call
LeaseErrorScope instead of LeaveScope at the end of the procedure.
* gm2-compiler/P2SymBuild.mod (P2EndBuildDefModule): Call
LeaseErrorScope instead of LeaveScope at the end of the procedure.
(P2EndBuildImplementationModule): Call
LeaseErrorScope instead of LeaveScope at the end of the procedure.
(P2EndBuildProgramModule): Call
LeaseErrorScope instead of LeaveScope at the end of the procedure.
(EndBuildInnerModule): Call
LeaseErrorScope instead of LeaveScope at the end of the procedure.
(P3EndBuildImpModule): Call
LeaseErrorScope instead of LeaveScope at the end of the procedure.
(P3EndBuildProgModule): Call
LeaseErrorScope instead of LeaveScope at the end of the procedure.
(EndBuildInnerModule): Call
LeaseErrorScope instead of LeaveScope at the end of the procedure.
* gm2-compiler/PCSymBuild.mod (PCEndBuildDefModule): Call
LeaseErrorScope instead of
LeaveScope at the end of the procedure.
(PCEndBuildImpModule): Call LeaseErrorScope instead of
LeaveScope at the end of the procedure.
(PCEndBuildProgModule): Call LeaseErrorScope instead of
LeaveScope at the end of the procedure.
(PCEndBuildInnerModule): Call LeaseErrorScope instead of
LeaveScope at the end of the procedure.
* gm2-compiler/SymbolKey.def (NoOfNodes): New procedure
function.
(ForeachNodeConditionDo) New procedure.
* gm2-compiler/SymbolKey.mod (NoOfNodes): New procedure
function.
(ContainsSymKey): Call FindNodeParentInTree instead of
FindNodeAndParentInTree.
(GetSymKey): Call FindNodeParentInTree instead of
FindNodeAndParentInTree.
(DelSymKey): Call FindNodeParentInTree instead of
FindNodeAndParentInTree.
(FindNodeParentInTree): Renamed from FindNodeAndParentInTree.
(IsEmptyTree): Reformatted.  (DoesTreeContainAny): Reformatted.
(SearchForAny): Reformatted.  (ForeachNodeConditionDo) New
procedure.  (SearchConditional) New procedure.
* gm2-compiler/SymbolTable.def (GetErrorScope): New procedure
function.  (PutErrorScope) New procedure.
* gm2-compiler/SymbolTable.def (GetErrorScope): New procedure
function implemented.  (PutErrorScope) New procedure implemented.
(AddListify) New procedure.  (Listify) New procedure.
(errorScope) field added to procedure, module, defimp
symbols and initialized during their construction.

Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>
22 files changed:
gcc/m2/Make-lang.in
gcc/m2/bnf/m2-1.bnf
gcc/m2/bnf/m2-2.bnf
gcc/m2/bnf/m2-3.bnf
gcc/m2/bnf/m2-c.bnf
gcc/m2/bnf/m2-h.bnf
gcc/m2/bnf/m2.bnf
gcc/m2/gm2-compiler/M2Comp.mod
gcc/m2/gm2-compiler/M2Error.def
gcc/m2/gm2-compiler/M2Error.mod
gcc/m2/gm2-compiler/M2MetaError.def
gcc/m2/gm2-compiler/M2MetaError.mod
gcc/m2/gm2-compiler/M2Scope.mod
gcc/m2/gm2-compiler/M2StackWord.mod
gcc/m2/gm2-compiler/P0SymBuild.mod
gcc/m2/gm2-compiler/P2SymBuild.mod
gcc/m2/gm2-compiler/P3SymBuild.mod
gcc/m2/gm2-compiler/PCSymBuild.mod
gcc/m2/gm2-compiler/SymbolKey.def
gcc/m2/gm2-compiler/SymbolKey.mod
gcc/m2/gm2-compiler/SymbolTable.def
gcc/m2/gm2-compiler/SymbolTable.mod
This page took 0.062158 seconds and 5 git commands to generate.