minigrace
Version:
A compiler for the Grace programming language
816 lines • 185 kB
JavaScript
let gracecode_basic_sourceFile = "/Users/black/Development/mg/gracelang/minigrace/basic.grace";
let gracecode_basic_sha256 = "65f3bd7976333b615a9d0b89885e6e701fbb297e21561704023be39d6cfb9b1f";
let gracecode_basic_minigraceRevision = "b57591d29fc5ee5270d114920bf671367b8c3ecb";
let gracecode_basic_minigraceGeneration = "5171";
if (typeof gctCache !== "undefined")
gctCache["basic"] = "dialect:\n standard\nfreshScopes:\n $103 trait\n $104\n $105\n $107\nmethodTypes:$103:\n line(l:Number)column(c:Number) \u2192 Position\n nullNode \u2192 AstNode\n start(s:Position)end(e:Position) \u2192 Range\nmethodTypes:$104:\n <(other:Position) \u2192 Boolean\n ==(other:Position) \u2192 Boolean\n >(other:Position) \u2192 Boolean\n hash \u2192 Number\n \u2264(other:Position) \u2192 Boolean\n \u2265(other:Position) \u2192 Boolean\nmethodTypes:$105:\n hash \u2192 Number\nmethodTypes:$106:\n childrenDo(anAction:Procedure1) \u2192 Unknown\n childrenMap(f:Function1) \u2192 Unknown\n end \u2192 Position\nmodules:\n standard\npath:\n /Users/black/Development/mg/gracelang/minigrace/basic.grace\nscope:$102:\n asDebugString String (go) $scope_string\n asString String (go) $scope_string\n basicAsString String (go) $scope_string\n isMe(1) Boolean (go) $scope_boolean\n myIdentityHash Number (go) $scope_number\n open Unknown (mth) $103\nscope:$103:\n AstNode type\n CompilerError Unknown (mth) $scope_done\n GatheringError Unknown (mth) $scope_done\n Position type\n Range type\n Scope type\n Variable type\n asDebugString String (go) $scope_string\n asString String (go) $scope_string\n basicAsString String (go) $scope_string\n canonicalName(1) Unknown (mth) $scope_done\n emptyRange Unknown (mth) $scope_done\n fakeSymbolTable Unknown (mth) $107 public\n isMe(1) Boolean (go) $scope_boolean\n line(1)column(1) Position (mth) $104\n myIdentityHash Number (go) $scope_number\n noPosition Unknown (mth) $scope_done\n nullNode AstNode (mth) $106\n numericName(1) Unknown (mth) $scope_done\n start(1)end(1) Range (mth) $105\nscope:$104:\n ::(1) Unknown (mth) $scope_done\n <(1) Boolean (mth) $scope_done\n ==(1) Boolean (mth) $scope_done\n >(1) Boolean (mth) $scope_done\n addColumn(1) Unknown (mth) $scope_done\n addLine(1) Unknown (mth) $scope_done\n asDebugString String (go) $scope_string\n asString Unknown (mth) $scope_done\n basicAsString String (go) $scope_string\n column Unknown (def) $scopeEmpty public\n hash Number (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n line Unknown (def) $scopeEmpty public\n myIdentityHash Number (go) $scope_number\n prefix== Unknown (mth) $scope_done\n prefix\u2260 Unknown (mth) $scope_done\n \u2260(1) Unknown (mth) $scope_done\n \u2264(1) Boolean (mth) $scope_done\n \u2265(1) Boolean (mth) $scope_done\nscope:$105:\n ::(1) Unknown (mth) $scope_done\n <(1) Unknown (mth) $scope_done\n ==(1) Unknown (mth) $scope_done\n >(1) Unknown (mth) $scope_done\n arrow Unknown (mth) $scope_done\n asDebugString String (go) $scope_string\n asString Unknown (mth) $scope_done\n basicAsString String (go) $scope_string\n column Unknown (mth) $scope_done\n end Unknown (def) $scopeEmpty public\n hash Number (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n line Unknown (mth) $scope_done\n lineRangeString Unknown (mth) $scope_done\n myIdentityHash Number (go) $scope_number\n prefix== Unknown (mth) $scope_done\n prefix\u2260 Unknown (mth) $scope_done\n rangeLongString Unknown (mth) $scope_done\n rangeString Unknown (mth) $scope_done\n start Unknown (def) $scopeEmpty public\n sugg Unknown (mth) $scope_done\n \u2260(1) Unknown (mth) $scope_done\n \u2264(1) Unknown (mth) $scope_done\n \u2265(1) Unknown (mth) $scope_done\nscope:$106:\n ::(1) Unknown (mth) $scope_done\n ==(1) Unknown (mth) $scope_done\n accept(1)from(1) Unknown (mth) $scope_done\n annotations Unknown (mth) $scope_done\n asDebugString String (go) $scope_string\n asString Unknown (mth) $scope_done\n basicAsString String (go) $scope_string\n childrenDo(1) Unknown (mth) $scope_done\n childrenMap(1) Unknown (mth) $scope_done\n column Unknown (def) $scope_number public\n column:=(1) Unknown (mth) $scope_done\n comments Unknown (mth) $scope_done\n decType Unknown (mth) $scope_done\n end Position (mth) $scope_done\n endCol Unknown (mth) $scope_done\n hasAnnotation(1) Unknown (mth) $scope_done\n hash Unknown (mth) $scope_done\n inClass Unknown (mth) $scope_done\n inTrait Unknown (mth) $scope_done\n isAssignment Unknown (mth) $scope_done\n isBlock Unknown (mth) $scope_done\n isBuiltIn Unknown (mth) $scope_done\n isCall Unknown (mth) $scope_done\n isClass Unknown (mth) $scope_done\n isComment Unknown (mth) $scope_done\n isConstant Unknown (mth) $scope_done\n isDeclaredByParent Unknown (mth) $scope_done\n isDialect Unknown (mth) $scope_done\n isExecutable Unknown (mth) $scope_done\n isExternal Unknown (mth) $scope_done\n isFresh Unknown (mth) $scope_done\n isIdentifier Unknown (mth) $scope_done\n isImport Unknown (mth) $scope_done\n isMarkerDeclaration Unknown (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n isMember Unknown (mth) $scope_done\n isMethod Unknown (mth) $scope_done\n isModule Unknown (mth) $scope_done\n isNull Unknown (mth) $scope_done\n isObject Unknown (mth) $scope_done\n isOuter Unknown (mth) $scope_done\n isReturn Unknown (mth) $scope_done\n isSelf Unknown (mth) $scope_done\n isSelfOrOuter Unknown (mth) $scope_done\n isSequenceConstructor Unknown (mth) $scope_done\n isSuper Unknown (mth) $scope_done\n isTrait Unknown (mth) $scope_done\n isTypeDec Unknown (mth) $scope_done\n kind Unknown (def) $scope_string public\n line Unknown (def) $scope_number public\n line:=(1) Unknown (mth) $scope_done\n map(1)ancestors(1) Unknown (mth) $scope_done\n myIdentityHash Number (go) $scope_number\n nameString Unknown (mth) $scope_done\n newAccept(1) Unknown (mth) $scope_done\n prefix== Unknown (mth) $scope_done\n prefix\u2260 Unknown (mth) $scope_done\n pretty(1) Unknown (mth) $scope_done\n range Unknown (mth) $scope_done\n register Unknown (def) $scope_string public\n scope Unknown (def) $107 public\n shallowCopy Unknown (mth) $scope_done\n start Unknown (mth) $scope_done\n toGrace(1) Unknown (mth) $scope_done\n \u2260(1) Unknown (mth) $scope_done\nscope:$107:\n ::(1) Unknown (mth) $scope_done\n ==(1) Unknown (mth) $scope_done\n areReusedNamesCompleted Unknown (mth) $scope_done\n asDebugString String (go) $scope_string\n asString Unknown (mth) $scope_done\n basicAsString String (go) $scope_string\n hash Unknown (mth) $scope_done\n isFresh Unknown (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n localNames Unknown (mth) $scope_done\n myIdentityHash Number (go) $scope_number\n node Unknown (var) $scopeEmpty public\n node:=(1) Unknown (var) $scopeEmpty public\n prefix== Unknown (mth) $scope_done\n prefix\u2260 Unknown (mth) $scope_done\n variety Unknown (mth) $scope_done\n varsAreMethods Unknown (mth) $scope_done\n \u2260(1) Unknown (mth) $scope_done\nself:\n $102\ntypedec:$103.AstNode:\n type AstNode = interface {\n isDeclaredByParent \u2192 Boolean\n kind \u2192 String\n register \u2192 String\n line \u2192 Number\n line:=(ln:Number)\n column \u2192 Number\n column:=(lp:Number)\n scope \u2192 Scope\n pretty(n:Number) \u2192 String\n comments \u2192 AstNode\n range \u2192 Range\n start \u2192 Position\n end \u2192 Position}\ntypedec:$103.Position:\n type Position = interface {\n line \u2192 Number\n column \u2192 Number\n >(other) \u2192 Boolean\n \u2265(other) \u2192 Boolean\n ==(other) \u2192 Boolean\n <(other) \u2192 Boolean\n \u2264(other) \u2192 Boolean}\ntypedec:$103.Range:\n type Range = interface {\n start \u2192 Position\n end \u2192 Position\n >(other) \u2192 Boolean\n \u2265(other) \u2192 Boolean\n ==(other) \u2192 Boolean\n <(other) \u2192 Boolean\n \u2264(other) \u2192 Boolean\n rangeString \u2192 String\n rangeLongString \u2192 String\n lineRangeString \u2192 String}\ntypedec:$103.Scope:\n type Scope = Object & interface {\n outerScope \u2192 Scope\n node \u2192 AstNode\n uid \u2192 String\n allNames \u2192 Sequence\u27e6String\u27e7\n in(anotherScope) \u2192 SelfType\n node(nu:AstNode) \u2192 SelfType\n lookup(name)ifAbsent(aBlock)\n lookup(name)\n lookupLocally(name)ifAbsent(aBlock)ifPresent(pBlock)\n isFresh \u2192 Boolean\n attributeScopeOf(aName:String)in(nd:AstNode) \u2192 Scope\n asString \u2192 String\n lookupLocallyOrReused(name)ifAbsent(aBlock)\n lookupLocallyOrReused(name)\n copy(other)\n areReusedNamesCompleted \u2192 Boolean\n currentObjectScope \u2192 SelfType\n reusedNames \u2192 Dictionary\n isModuleScope \u2192 Boolean\n reuses(name) \u2192 Boolean\n lookup(name)ifAbsent(aBlock)ifPresent(pBlock)\n ==(other) \u2192 Boolean\n lookupLexically(name)\n redeclarationError(aMessage)variable(aVariable) \u2192 None\n add(aVariable)withName(aName) \u2192 Variable\n structuralError(aMessage)variable(aVariable) \u2192 None\n allNamesAndValuesDo(aBlock) \u2192 Done\n defines(name) \u2192 Boolean\n redefine(aVariable)withName(aName) \u2192 Variable\n hash \u2192 Number\n isTrait \u2192 Boolean\n isTheEmptyScope \u2192 Boolean\n isDialectScope \u2192 Boolean\n localAndReusedNamesAndValuesDo(aBlock) \u2192 Done\n lookupReused(name)ifAbsent(aBlock)\n lookupReused(name)ifAbsent(aBlock)ifPresent(pBlock)\n lookupLexically(name)ifAbsent(aBlock)\n definesLocallyOrReuses(name) \u2192 Boolean\n dialectError(aString) \u2192 None\n localNamesAndValuesDo(aBlock) \u2192 Done\n removeReused(aName)ifAbsent(aBlock) \u2192 Done\n lookupLocallyOrOutwards(name)ifAbsent(aBlock) \u2192 Variable\n add(aVariable) \u2192 Variable\n localNames \u2192 Dictionary\n lookupLocally(name)ifAbsent(aBlock) \u2192 Variable\n reusedNamesAndValuesDo(aBlock) \u2192 Done\n definesLocally(name) \u2192 Boolean\n doesNotDefineLocally(name) \u2192 Boolean\n lookupLocallyOrReused(name)ifAbsent(aBlock)ifPresent(pBlock) \u2192 Variable\n isObjectScope \u2192 Boolean\n variety \u2192 String\n clear \u2192 Done\n withSurroundingScopesDo(b) \u2192 Done}\ntypedec:$103.Variable:\n type Variable = interface {\n canBeOriginOfSuperExpression \u2192 Boolean\n canonicalName \u2192 String\n declaredName \u2192 String\n definingParseNode \u2192 AstNode\n definingScope \u2192 Scope\n isAnnotatedConfidential \u2192 Boolean\n isAnnotatedPublic \u2192 Boolean\n isAnnotatedReadable \u2192 Boolean\n isAnnotatedWith(anAnnotationName) \u2192 Boolean\n isAnnotatedWritable \u2192 Boolean\n isAssignable \u2192 Boolean\n isAvailableForReuse \u2192 Boolean\n isConcrete \u2192 Boolean\n isConfidential \u2192 Boolean\n isExplicitMethod \u2192 Boolean\n isIfThenElse \u2192 Boolean\n isImport \u2192 Boolean\n isMatchCase \u2192 Boolean\n isMethod \u2192 Boolean\n isMethodOrType \u2192 Boolean\n isOnceMethod \u2192 Boolean\n isPublic \u2192 Boolean\n isPublicByDefault \u2192 Boolean\n isReadable \u2192 Boolean\n isSpecialControlStructure \u2192 Boolean\n isTryCatch \u2192 Boolean\n isType \u2192 Boolean\n isTypeParameter \u2192 Boolean\n isWritable \u2192 Boolean\n kind \u2192 String\n lineRangeString \u2192 String\n moduleName \u2192 String\n range \u2192 Range\n rangeLongString \u2192 String\n rangeString \u2192 Boolean\n startPosition \u2192 Position\n stopPosition \u2192 Position}\ntypes:\n $103.AstNode\n $103.Position\n $103.Range\n $103.Scope\n $103.Variable\n";
if (typeof originalSourceLines !== "undefined") {
originalSourceLines["basic"] = [
"dialect \"standard\"",
"",
"// A bundle of basic definitions used in many parts of the minigrace compiler",
"//",
"// AstNode: the type of a parse node cum AST node",
"// Position — the type of a point in the source code",
"// Range — the type of a range of the source code",
"// Scope — the type of a symbol table of declared identifiers",
"// Variable — the type of symbol table entry describing a declared variable",
"// noPosition — a null source-code position",
"// emptyRange — an empty source code range",
"// nullNode:AstNode — a \"null\" for AST nodes",
"// class fakeSymbolTable — generates a new placeholder symbol table",
"// method canonicalName(n) — converts a neumeric name to canonical form",
"// method numericName(c) — converts a canonical name to numeric form",
"",
"trait open {",
"",
" // defines positions, and ranges, in the source",
"",
" type Position = interface {",
" line → Number",
" column → Number",
" > (other) → Boolean",
" ≥ (other) → Boolean",
" == (other) → Boolean",
" < (other) → Boolean",
" ≤ (other) → Boolean",
" }",
" type Range = interface {",
" start → Position",
" end → Position",
" > (other) → Boolean",
" ≥ (other) → Boolean",
" == (other) → Boolean",
" < (other) → Boolean",
" ≤ (other) → Boolean",
" rangeString → String",
" rangeLongString → String",
" lineRangeString → String",
" }",
" type Scope = Object & interface {",
" outerScope → Scope",
" node → AstNode",
" uid → String",
" allNames → Sequence⟦String⟧",
" in(anotherScope) → SelfType",
" // sets the outerScope for this scope, and returns self",
" node(nu:AstNode) → SelfType",
" // sets the node for this scope, and returns self",
" lookup (name) ifAbsent (aBlock)",
" // Return the variable corresponding to name, which may or may not be",
" // defined in this scope, or in one of the lexically surrounding scopes.",
" // If it is not defined, return the value of executing aBlock.",
" lookup (name)",
" // Return the variable corresponding to name, which must be",
" // defined in this scope, or in one of the lexically surrounding scopes.",
"",
" lookupLocally (name) ifAbsent (aBlock) ifPresent (pBlock)",
" // Look up variable corresponding to name, which may or may not be defined",
" // in this scope. If it is not defined, return the result of executing",
" // aBlock; otherwise, return the result of applying pBlock to the variable.",
" isFresh → Boolean",
" // answer true if this scope is one that can be used or inherited",
" attributeScopeOf (aName:String) in (nd:AstNode) → Scope",
" asString → String",
" lookupLocallyOrReused (name) ifAbsent (aBlock)",
" // Return the variable corresponding to name, which may or may not be defined in this scope,",
" // or in one of the scopes that it reuses.",
" // If name is not defined, return the value of executing aBlock.",
" lookupLocallyOrReused (name)",
" copy(other)",
" areReusedNamesCompleted → Boolean",
" currentObjectScope → SelfType",
" reusedNames → Dictionary",
" isModuleScope → Boolean",
" reuses (name) → Boolean",
" // Is name defined by a scope that this scope reuses?",
" lookup (name) ifAbsent (aBlock) ifPresent (pBlock)",
" // applies pBlock to the variable corresponding to name, if it is defined",
" // in this scope, or in one of the lexically surrounding scopes. If it",
" // is not defined, return the value of executing aBlock",
" == (other) → Boolean",
" lookupLexically (name)",
" redeclarationError (aMessage) variable (aVariable) → None",
" // raises a NamingError",
" add (aVariable) withName (aName) → Variable",
" structuralError (aMessage) variable (aVariable) → None",
" // raises a NamingError",
" allNamesAndValuesDo (aBlock) → Done",
" defines (name) → Boolean",
" // Is name defined in this scope, or in one of the lexically surrounding scopes?",
" redefine (aVariable) withName (aName) → Variable",
" hash → Number",
" isTrait → Boolean",
" isTheEmptyScope → Boolean",
" isDialectScope → Boolean",
" localAndReusedNamesAndValuesDo (aBlock) → Done",
" lookupReused (name) ifAbsent (aBlock)",
" lookupReused (name) ifAbsent (aBlock) ifPresent (pBlock)",
" lookupLexically (name) ifAbsent (aBlock)",
" definesLocallyOrReuses (name) → Boolean",
" dialectError (aString) → None",
" // raises a CompilationError",
" localNamesAndValuesDo (aBlock) → Done",
" removeReused (aName) ifAbsent (aBlock) → Done",
" lookupLocallyOrOutwards (name) ifAbsent (aBlock) → Variable",
" add (aVariable) → Variable",
" localNames → Dictionary",
" lookupLocally (name) ifAbsent (aBlock) → Variable",
" reusedNamesAndValuesDo (aBlock) → Done",
" definesLocally (name) → Boolean",
" // Is name defined in this scope (ignoring surrounding scopes and required methods)",
"",
" doesNotDefineLocally (name) → Boolean",
" lookupLocallyOrReused (name) ifAbsent (aBlock) ifPresent (pBlock) → Variable",
" isObjectScope → Boolean",
" variety → String",
" clear → Done",
" withSurroundingScopesDo (b) → Done",
" // do b in this scope and all surrounding scopes.",
" }",
" type Variable = interface {",
" canBeOriginOfSuperExpression → Boolean",
" canonicalName → String",
" declaredName → String",
" definingParseNode → AstNode",
" definingScope → Scope",
" isAnnotatedConfidential → Boolean",
" isAnnotatedPublic → Boolean",
" isAnnotatedReadable → Boolean",
" isAnnotatedWith (anAnnotationName) → Boolean",
" isAnnotatedWritable → Boolean",
" isAssignable → Boolean",
" isAvailableForReuse → Boolean",
" isConcrete → Boolean",
" isConfidential → Boolean",
" isExplicitMethod → Boolean",
" isIfThenElse → Boolean",
" isImport → Boolean",
" isMatchCase → Boolean",
" isMethod → Boolean",
" isMethodOrType → Boolean",
" isOnceMethod → Boolean",
" isPublic → Boolean",
" isPublicByDefault → Boolean",
" isReadable → Boolean",
" isSpecialControlStructure → Boolean",
" isTryCatch → Boolean",
" isType → Boolean",
" isTypeParameter → Boolean",
" isWritable → Boolean",
" kind → String",
" lineRangeString → String",
" moduleName → String",
" range → Range",
" rangeLongString → String",
" rangeString → Boolean",
" startPosition → Position",
" stopPosition → Position",
" }",
" class line (l:Number) column (c:Number) → Position {",
" use equality",
" def line is public = l",
" def column is public = c",
" method > (other:Position) → Boolean {",
" if (line > other.line) then { return true }",
" if (line < other.line) then { return false }",
" (column > other.column)",
" }",
" method ≥ (other:Position) → Boolean {",
" if (line > other.line) then { return true }",
" if (line < other.line) then { return false }",
" (column ≥ other.column)",
" }",
" method == (other:Position) → Boolean {",
" (line == other.line) && (column == other.column)",
" }",
" method hash → Number {",
" hashCombine(line.hash, column.hash)",
" }",
" method ≤ (other:Position) → Boolean {",
" (other > self).not",
" }",
" method < (other:Position) → Boolean {",
" (other ≥ self).not",
" }",
" method asString { \"{line}:{column}\" }",
" method addColumn(n) { line (line) column (column+n) }",
" method addLine(n) { line (line+n) column (column) }",
" }",
" class start (s:Position) end (e:Position) → Range {",
" use equality",
" def start is public = s",
" def end is public = e",
" method asString { rangeString }",
" method == (other) { (start == other.start) && (end == other.end) }",
" method < (other) { (start < other.start) }",
" method ≤ (other) { (start ≤ other.start) }",
" method > (other) { (start > other.start) }",
" method ≥ (other) { (start ≥ other.start) }",
" method hash → Number { hashCombine(start.hash, end.hash) }",
" method rangeLongString {",
" // returns a range string such as \"line 17 column 5\" ,",
" // \"line 17 columns 5 to 25\", or \"line 17 column 5 to line 22 column 10\"",
" if ((start == end) || (end == noPosition)) then {",
" \"line {start.line} column {start.column}\"",
" } elseif { end.line == start.line } then {",
" \"line {start.line}, columns {start.column}-{end.column}\"",
" } else {",
" \"line {start.line} column {start.column} to line \" ++",
" \"{end.line} column {end.column}\"",
" }",
" }",
" method line { start.line }",
" method column { start.column }",
"",
" method arrow { (\"-\" * (start.column-1)) ++ (\"^\" * (end.column - start.column + 1)) }",
" // so that we can behave as an error object",
" method sugg { [] }",
" // so that we can behave as an error object",
" method rangeString {",
" // returns a range string such as \"17:5\" , \"17:5-25\" or \"17:5–22:10\"",
" if ((start == end) || (end == noPosition)) then {",
" start.asString",
" } elseif { end.line == start.line } then {",
" \"{start}-{end.column}\"",
" } else {",
" \"{start}-{end}\"",
" }",
" }",
" method lineRangeString {",
" // returns a line range such as \"line 17\", or \"lines 17–21\"",
" if ((start.line == end.line) || (end == noPosition)) then {",
" \"line {start.line}\"",
" } else {",
" \"lines {start.line}-{end.line}\"",
" }",
" }",
" }",
" once method noPosition { line 0 column 0 }",
" once method emptyRange { start (noPosition) end (noPosition) }",
"",
" type AstNode = interface {",
" isDeclaredByParent → Boolean",
" // for a declaration node or identifier, true when the thing being",
" // declared is decared in the outerscope, rather than in scope",
" kind → String",
" // Used for pseudo-instanceof tests, and for printing",
" register → String",
" // Used in the code generator to name the resulting object",
" line → Number",
" // The source line the node came from; the first line is 1",
" line:=(ln:Number)",
" column → Number",
" // the first column is 1",
" column:=(lp:Number)",
" scope → Scope",
" // The symbol table for names defined in this node and its sub-nodes",
" pretty(n:Number) → String",
" // Pretty-print-string of node at depth n",
" comments → AstNode",
" // Comments associated with this node",
" range → Range",
" // The source range represented by this node",
" start → Position",
" // The start of the source range represented by this node",
" end → Position",
" // The end of the source range represented by this node",
" }",
"",
" once class nullNode → AstNode {",
" use identityEquality",
" def kind is public = \"null\"",
" def register is public = \"null\"",
" def line is public = 0",
" def column is public = 0",
" def scope is public = fakeSymbolTable",
" method decType {",
" self // can't be Unknown, because ast depends on this module",
" }",
" method nameString { asString }",
" method isMarkerDeclaration { false }",
" method hasAnnotation(_) { false }",
" method isDeclaredByParent { false }",
" method isMember { false }",
" method isMethod { false }",
" method isDialect { false }",
" method isModule { false }",
" method isExecutable { false }",
" method isCall { false }",
" method isComment { false }",
" method isClass { false } // is a method that returns a fresh object",
" method inClass { false } // object in a syntactic class definiton",
" method isTrait { false } // is a method that returns a trait object",
" method inTrait { false } // object in a syntactic trait definition",
" method isAssignment { false }",
" method isReturn { false }",
" method isSelf { false }",
" method isSuper { false }",
" method isBuiltIn { false }",
" method isOuter { false }",
" method isSelfOrOuter { false }",
" method isBlock { false }",
" method isObject { false }",
" method isIdentifier { false }",
" method isImport { false }",
" method isTypeDec { false }",
" method isExternal { false }",
" method isFresh { false }",
" method isConstant { false }",
" method isSequenceConstructor { false }",
" method start { line (line) column (column) }",
" method childrenDo(anAction:Procedure1) { done }",
" method childrenMap(f:Function1) { [] }",
" method newAccept(aVisitor) {",
" aVisitor.preVisit(self)",
" aVisitor.postVisit(self) result(aVisitor.newVisitNull(self))",
" }",
" method toGrace(depth) {",
" \"// null\"",
" }",
" method range { emptyRange }",
" method endCol { 0 }",
" method annotations { [] }",
" method end → Position { line (0) column (0) }",
" method asString { \"the nullNode\" }",
" method isNull { true }",
" method accept(visitor) from (ac) { }",
" method map(blk) ancestors(ac) { self }",
" method shallowCopy { self }",
" method column:=(_) { ProgrammingError.raise \"Can't change column of nullNode\" }",
" method comments { ProgrammingError.raise \"Can't get comments from nullNode\" }",
" method line:=(_) { ProgrammingError.raise \"Can't change line of nullNode\" }",
" method pretty(n) { toGrace(n) }",
" }",
"",
" class fakeSymbolTable is public {",
" use identityEquality",
" var node is public // will be initialized when this node",
" // is placed in an AstNode using scope:=(_).",
" // Can't make it nullNode now, because nullNode",
" // initializes its scope to fakeSymbolTable",
" method asString { \"the fakeSymbolTable\" }",
" method isFresh { false }",
" method varsAreMethods { true }",
" method variety { \"fake\" }",
" method areReusedNamesCompleted { true }",
" method localNames { [] }",
" }",
"",
" method canonicalName(n) {",
" // converts n, a minigrace numeric method name, to the canonical name",
" native \"js\" code ‹return new GraceString(canonicalMethodName(var_n._value));›",
" }",
"",
" method numericName(c) {",
" // converts c, a Grace canonical method name, to minigrace's numeric name",
" native \"js\" code ‹return new GraceString(numericMethodName(var_c._value));›",
" }",
"",
" once method CompilerError { ProgrammingError.refine \"CompilerError\" }",
" once method GatheringError { CompilerError.refine \"GatheringError\" }",
"}" ];
}
function gracecode_basic() {
importedModules["basic"] = this;
const var_$module = this;
this.definitionModule = "basic";
this.definitionLine = 1;
setLineNumber(1); // compilenode dialect
// Dialect "standard"
const var_$dialect = do_import("standard", gracecode_standard);
this.outer = var_$dialect;
this.closureKeys = this.closureKeys || [];
this.closureKeys.push("outer_basic_1");
this.outer_basic_1 = var_$dialect;
var func0 = function(argcv) { // method open, line 17
var returnTarget = invocationCount;
invocationCount++;
const numArgs = arguments.length - 1;
if ((numArgs > 0) && (numArgs !== 0)) {
raiseTypeArgError("open", 0, numArgs - 0);
}
var ouc = emptyGraceObject("open", "basic", 17);
var ouc_init = this.methods["open$build(3)"].call(this, null, ouc, [], []);
ouc_init.call(ouc);
return ouc;
}; // end of method open
this.methods["open"] = func0;
func0.methodName = "open";
func0.paramCounts = [0];
func0.paramNames = [];
func0.definitionLine = 17;
func0.definitionModule = "basic";
var func1 = function(argcv, inheritingObject, aliases, exclusions) { // method open$build(_,_,_), line 17
var returnTarget = invocationCount;
invocationCount++;
const numArgs = arguments.length - 4;
if ((numArgs > 0) && (numArgs !== 0)) {
raiseTypeArgError("open", 0, numArgs - 0);
}
var obj2_build = function(ignore, outerObj, aliases, exclusions) {
this.closureKeys = this.closureKeys || [];
this.closureKeys.push("outer_basic_17");
this.outer_basic_17 = outerObj;
const inheritedExclusions = { };
for (var eix = 0, eLen = exclusions.length; eix < eLen; eix ++) {
const exMeth = exclusions[eix];
inheritedExclusions[exMeth] = this.methods[exMeth]; };
// Type decl Position
var func4 = function(argcv) { // method Position, line 1
var returnTarget = invocationCount;
invocationCount++;
setLineNumber(21); // compilenode interfaceliteral
// interface literal
var iface5 = new GraceInterface("Position");
sig6 = () => {
setLineNumber(22); // compilenode member
var call7 = selfRequest(var_$dialect, "Number", [0]);
return new GraceSignature("line", [], [], [], call7);
}
sig8 = () => {
setLineNumber(23); // compilenode member
var call9 = selfRequest(var_$dialect, "Number", [0]);
return new GraceSignature("column", [], [], [], call9);
}
sig10 = () => {
setLineNumber(24); // compilenode member
var call11 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature(">(1)", ["other"], [], [type_Unknown], call11);
}
sig12 = () => {
setLineNumber(25); // compilenode member
var call13 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("≥(1)", ["other"], [], [type_Unknown], call13);
}
sig14 = () => {
setLineNumber(26); // compilenode member
var call15 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("==(1)", ["other"], [], [type_Unknown], call15);
}
sig16 = () => {
setLineNumber(27); // compilenode member
var call17 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("<(1)", ["other"], [], [type_Unknown], call17);
}
sig18 = () => {
setLineNumber(28); // compilenode member
var call19 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("≤(1)", ["other"], [], [type_Unknown], call19);
}
iface5.typeMethods = {
"line": sig6
, "column": sig8
, ">(1)": sig10
, "≥(1)": sig12
, "==(1)": sig14
, "<(1)": sig16
, "≤(1)": sig18
};
return iface5;
}; // end of method Position
function memofunc4(argcv) {
if (! this.data["memo$Position"]) // parameterless memo function
this.data["memo$Position"] = func4.call(this, argcv);
return this.data["memo$Position"];
};
this.methods["Position"] = memofunc4;
memofunc4.methodName = "Position";
memofunc4.paramCounts = [0];
memofunc4.paramNames = [];
memofunc4.definitionLine = 1;
memofunc4.definitionModule = "basic";
func4.methodName = "Position";
func4.paramCounts = [0];
func4.paramNames = [];
func4.definitionLine = 1;
func4.definitionModule = "basic";
// Type decl Range
var func21 = function(argcv) { // method Range, line 1
var returnTarget = invocationCount;
invocationCount++;
setLineNumber(30); // compilenode interfaceliteral
// interface literal
var iface22 = new GraceInterface("Range");
sig23 = () => {
setLineNumber(31); // compilenode member
var call24 = selfRequest(this, "Position", [0]);
return new GraceSignature("start", [], [], [], call24);
}
sig25 = () => {
setLineNumber(32); // compilenode member
var call26 = selfRequest(this, "Position", [0]);
return new GraceSignature("end", [], [], [], call26);
}
sig27 = () => {
setLineNumber(33); // compilenode member
var call28 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature(">(1)", ["other"], [], [type_Unknown], call28);
}
sig29 = () => {
setLineNumber(34); // compilenode member
var call30 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("≥(1)", ["other"], [], [type_Unknown], call30);
}
sig31 = () => {
setLineNumber(35); // compilenode member
var call32 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("==(1)", ["other"], [], [type_Unknown], call32);
}
sig33 = () => {
setLineNumber(36); // compilenode member
var call34 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("<(1)", ["other"], [], [type_Unknown], call34);
}
sig35 = () => {
setLineNumber(37); // compilenode member
var call36 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("≤(1)", ["other"], [], [type_Unknown], call36);
}
sig37 = () => {
setLineNumber(38); // compilenode member
var call38 = selfRequest(var_$dialect, "String", [0]);
return new GraceSignature("rangeString", [], [], [], call38);
}
sig39 = () => {
setLineNumber(39); // compilenode member
var call40 = selfRequest(var_$dialect, "String", [0]);
return new GraceSignature("rangeLongString", [], [], [], call40);
}
sig41 = () => {
setLineNumber(40); // compilenode member
var call42 = selfRequest(var_$dialect, "String", [0]);
return new GraceSignature("lineRangeString", [], [], [], call42);
}
iface22.typeMethods = {
"start": sig23
, "end": sig25
, ">(1)": sig27
, "≥(1)": sig29
, "==(1)": sig31
, "<(1)": sig33
, "≤(1)": sig35
, "rangeString": sig37
, "rangeLongString": sig39
, "lineRangeString": sig41
};
return iface22;
}; // end of method Range
function memofunc21(argcv) {
if (! this.data["memo$Range"]) // parameterless memo function
this.data["memo$Range"] = func21.call(this, argcv);
return this.data["memo$Range"];
};
this.methods["Range"] = memofunc21;
memofunc21.methodName = "Range";
memofunc21.paramCounts = [0];
memofunc21.paramNames = [];
memofunc21.definitionLine = 1;
memofunc21.definitionModule = "basic";
func21.methodName = "Range";
func21.paramCounts = [0];
func21.paramNames = [];
func21.definitionLine = 1;
func21.definitionModule = "basic";
// Type decl Scope
var func44 = function(argcv) { // method Scope, line 1
var returnTarget = invocationCount;
invocationCount++;
setLineNumber(1); // compilenode string
var string46 = new GraceString("Scope");
// call case 4: other requests
setLineNumber(42); // compilenode interfaceliteral
// interface literal
var iface48 = new GraceInterface("\u2039anon\u203a");
sig49 = () => {
setLineNumber(43); // compilenode member
var call50 = selfRequest(this, "Scope", [0]);
return new GraceSignature("outerScope", [], [], [], call50);
}
sig51 = () => {
setLineNumber(44); // compilenode member
var call52 = selfRequest(this, "AstNode", [0]);
return new GraceSignature("node", [], [], [], call52);
}
sig53 = () => {
setLineNumber(45); // compilenode member
var call54 = selfRequest(var_$dialect, "String", [0]);
return new GraceSignature("uid", [], [], [], call54);
}
sig55 = () => {
setLineNumber(46); // compilenode member
var call56 = selfRequest(var_$dialect, "Sequence", [0]);
return new GraceSignature("allNames", [], [], [], call56);
}
sig57 = () => {
setLineNumber(47); // compilenode member
var call58 = selfRequest(var_$dialect, "SelfType", [0]);
return new GraceSignature("in(1)", ["anotherScope"], [], [type_Unknown], call58);
}
sig59 = () => {
setLineNumber(49); // compilenode member
var call60 = selfRequest(this, "AstNode", [0]);
var call61 = selfRequest(var_$dialect, "SelfType", [0]);
return new GraceSignature("node(1)", ["nu"], [], [call60], call61);
}
sig62 = () => {
return new GraceSignature("lookup(1)ifAbsent(1)", ["name", "aBlock"], [], [type_Unknown, type_Unknown], type_Unknown);
}
sig63 = () => {
return new GraceSignature("lookup(1)", ["name"], [], [type_Unknown], type_Unknown);
}
sig64 = () => {
return new GraceSignature("lookupLocally(1)ifAbsent(1)ifPresent(1)", ["name", "aBlock", "pBlock"], [], [type_Unknown, type_Unknown, type_Unknown], type_Unknown);
}
sig65 = () => {
setLineNumber(63); // compilenode member
var call66 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("isFresh", [], [], [], call66);
}
sig67 = () => {
setLineNumber(65); // compilenode member
var call68 = selfRequest(var_$dialect, "String", [0]);
var call69 = selfRequest(this, "AstNode", [0]);
var call70 = selfRequest(this, "Scope", [0]);
return new GraceSignature("attributeScopeOf(1)in(1)", ["aName", "nd"], [], [call68, call69], call70);
}
sig71 = () => {
setLineNumber(66); // compilenode member
var call72 = selfRequest(var_$dialect, "String", [0]);
return new GraceSignature("asString", [], [], [], call72);
}
sig73 = () => {
return new GraceSignature("lookupLocallyOrReused(1)ifAbsent(1)", ["name", "aBlock"], [], [type_Unknown, type_Unknown], type_Unknown);
}
sig74 = () => {
return new GraceSignature("lookupLocallyOrReused(1)", ["name"], [], [type_Unknown], type_Unknown);
}
sig75 = () => {
return new GraceSignature("copy(1)", ["other"], [], [type_Unknown], type_Unknown);
}
sig76 = () => {
setLineNumber(73); // compilenode member
var call77 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("areReusedNamesCompleted", [], [], [], call77);
}
sig78 = () => {
setLineNumber(74); // compilenode member
var call79 = selfRequest(var_$dialect, "SelfType", [0]);
return new GraceSignature("currentObjectScope", [], [], [], call79);
}
sig80 = () => {
setLineNumber(75); // compilenode member
var call81 = selfRequest(var_$dialect, "Dictionary", [0]);
return new GraceSignature("reusedNames", [], [], [], call81);
}
sig82 = () => {
setLineNumber(76); // compilenode member
var call83 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("isModuleScope", [], [], [], call83);
}
sig84 = () => {
setLineNumber(77); // compilenode member
var call85 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("reuses(1)", ["name"], [], [type_Unknown], call85);
}
sig86 = () => {
return new GraceSignature("lookup(1)ifAbsent(1)ifPresent(1)", ["name", "aBlock", "pBlock"], [], [type_Unknown, type_Unknown, type_Unknown], type_Unknown);
}
sig87 = () => {
setLineNumber(83); // compilenode member
var call88 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("==(1)", ["other"], [], [type_Unknown], call88);
}
sig89 = () => {
return new GraceSignature("lookupLexically(1)", ["name"], [], [type_Unknown], type_Unknown);
}
sig90 = () => {
setLineNumber(85); // compilenode member
var call91 = selfRequest(var_$dialect, "None", [0]);
return new GraceSignature("redeclarationError(1)variable(1)", ["aMessage", "aVariable"], [], [type_Unknown, type_Unknown], call91);
}
sig92 = () => {
setLineNumber(87); // compilenode member
var call93 = selfRequest(this, "Variable", [0]);
return new GraceSignature("add(1)withName(1)", ["aVariable", "aName"], [], [type_Unknown, type_Unknown], call93);
}
sig94 = () => {
setLineNumber(88); // compilenode member
var call95 = selfRequest(var_$dialect, "None", [0]);
return new GraceSignature("structuralError(1)variable(1)", ["aMessage", "aVariable"], [], [type_Unknown, type_Unknown], call95);
}
sig96 = () => {
setLineNumber(90); // compilenode member
var call97 = selfRequest(var_$dialect, "Done", [0]);
return new GraceSignature("allNamesAndValuesDo(1)", ["aBlock"], [], [type_Unknown], call97);
}
sig98 = () => {
setLineNumber(91); // compilenode member
var call99 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("defines(1)", ["name"], [], [type_Unknown], call99);
}
sig100 = () => {
setLineNumber(93); // compilenode member
var call101 = selfRequest(this, "Variable", [0]);
return new GraceSignature("redefine(1)withName(1)", ["aVariable", "aName"], [], [type_Unknown, type_Unknown], call101);
}
sig102 = () => {
setLineNumber(94); // compilenode member
var call103 = selfRequest(var_$dialect, "Number", [0]);
return new GraceSignature("hash", [], [], [], call103);
}
sig104 = () => {
setLineNumber(95); // compilenode member
var call105 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("isTrait", [], [], [], call105);
}
sig106 = () => {
setLineNumber(96); // compilenode member
var call107 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("isTheEmptyScope", [], [], [], call107);
}
sig108 = () => {
setLineNumber(97); // compilenode member
var call109 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("isDialectScope", [], [], [], call109);
}
sig110 = () => {
setLineNumber(98); // compilenode member
var call111 = selfRequest(var_$dialect, "Done", [0]);
return new GraceSignature("localAndReusedNamesAndValuesDo(1)", ["aBlock"], [], [type_Unknown], call111);
}
sig112 = () => {
return new GraceSignature("lookupReused(1)ifAbsent(1)", ["name", "aBlock"], [], [type_Unknown, type_Unknown], type_Unknown);
}
sig113 = () => {
return new GraceSignature("lookupReused(1)ifAbsent(1)ifPresent(1)", ["name", "aBlock", "pBlock"], [], [type_Unknown, type_Unknown, type_Unknown], type_Unknown);
}
sig114 = () => {
return new GraceSignature("lookupLexically(1)ifAbsent(1)", ["name", "aBlock"], [], [type_Unknown, type_Unknown], type_Unknown);
}
sig115 = () => {
setLineNumber(102); // compilenode member
var call116 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("definesLocallyOrReuses(1)", ["name"], [], [type_Unknown], call116);
}
sig117 = () => {
setLineNumber(103); // compilenode member
var call118 = selfRequest(var_$dialect, "None", [0]);
return new GraceSignature("dialectError(1)", ["aString"], [], [type_Unknown], call118);
}
sig119 = () => {
setLineNumber(105); // compilenode member
var call120 = selfRequest(var_$dialect, "Done", [0]);
return new GraceSignature("localNamesAndValuesDo(1)", ["aBlock"], [], [type_Unknown], call120);
}
sig121 = () => {
setLineNumber(106); // compilenode member
var call122 = selfRequest(var_$dialect, "Done", [0]);
return new GraceSignature("removeReused(1)ifAbsent(1)", ["aName", "aBlock"], [], [type_Unknown, type_Unknown], call122);
}
sig123 = () => {
setLineNumber(107); // compilenode member
var call124 = selfRequest(this, "Variable", [0]);
return new GraceSignature("lookupLocallyOrOutwards(1)ifAbsent(1)", ["name", "aBlock"], [], [type_Unknown, type_Unknown], call124);
}
sig125 = () => {
setLineNumber(108); // compilenode member
var call126 = selfRequest(this, "Variable", [0]);
return new GraceSignature("add(1)", ["aVariable"], [], [type_Unknown], call126);
}
sig127 = () => {
setLineNumber(109); // compilenode member
var call128 = selfRequest(var_$dialect, "Dictionary", [0]);
return new GraceSignature("localNames", [], [], [], call128);
}
sig129 = () => {
setLineNumber(110); // compilenode member
var call130 = selfRequest(this, "Variable", [0]);
return new GraceSignature("lookupLocally(1)ifAbsent(1)", ["name", "aBlock"], [], [type_Unknown, type_Unknown], call130);
}
sig131 = () => {
setLineNumber(111); // compilenode member
var call132 = selfRequest(var_$dialect, "Done", [0]);
return new GraceSignature("reusedNamesAndValuesDo(1)", ["aBlock"], [], [type_Unknown], call132);
}
sig133 = () => {
setLineNumber(112); // compilenode member
var call134 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("definesLocally(1)", ["name"], [], [type_Unknown], call134);
}
sig135 = () => {
setLineNumber(115); // compilenode member
var call136 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("doesNotDefineLocally(1)", ["name"], [], [type_Unknown], call136);
}
sig137 = () => {
setLineNumber(116); // compilenode member
var call138 = selfRequest(this, "Variable", [0]);
return new GraceSignature("lookupLocallyOrReused(1)ifAbsent(1)ifPresent(1)", ["name", "aBlock", "pBlock"], [], [type_Unknown, type_Unknown, type_Unknown], call138);
}
sig139 = () => {
setLineNumber(117); // compilenode member
var call140 = selfRequest(var_$dialect, "Boolean", [0]);
return new GraceSignature("isObjectScope", [], [], [], call140);
}
sig141 = (