-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a kernel function SYNTAX_TREE that translates a previously coded GAP function into a syntax tree by using GAP records.
- Loading branch information
Showing
10 changed files
with
996 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## syntaxtree.gd | ||
|
||
DeclareCategory("IsSyntaxTree", IsObject); | ||
BindGlobal("SyntaxTreeType", NewType( NewFamily( "SyntaxTreeFamily" ) | ||
, IsSyntaxTree and IsComponentObjectRep ) ); | ||
|
||
## <#GAPDoc Label="SyntaxTree"> | ||
## <ManSection> | ||
## <Func Name="SyntaxTree" Arg='f'/> | ||
## | ||
## <Description> | ||
## Takes a GAP function <A>f</A> and returns its syntax tree. | ||
## | ||
## </Description> | ||
## </ManSection> | ||
## <#/GAPDoc> | ||
DeclareGlobalFunction("SyntaxTree"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# syntaxtree.gi | ||
|
||
InstallGlobalFunction( SyntaxTree, | ||
function(f) | ||
if (not IsFunction(f)) or IsOperation(f) or IsKernelFunction(f) then | ||
Error("SyntaxTree: <f> must be a plain GAP function, not a ", TNAM_OBJ(f)); | ||
fi; | ||
return Objectify( SyntaxTreeType, rec( file := FilenameFunc(f) | ||
, line := StartlineFunc(f) | ||
, tree := SYNTAX_TREE(f) ) ); | ||
end); | ||
|
||
InstallMethod( ViewString, "for a syntax tree" | ||
, [ IsSyntaxTree ] | ||
, t -> "<syntax tree>" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.