1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-04 17:07:28 +03:00

Do not duplicate nockma stdlib in the nockma backend (#3005)

This commit is contained in:
Jan Mas Rovira 2024-09-09 14:02:47 +02:00 committed by GitHub
parent 372375ef4d
commit f47b9b0034
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 2 deletions

View File

@ -122,6 +122,7 @@ data AtomHint
| AtomHintNil
| AtomHintVoid
| AtomHintFunctionsPlaceholder
| AtomHintStdlibPlaceholder
| AtomHintString
deriving stock (Show, Eq, Lift, Generic)

View File

@ -44,6 +44,7 @@ instance forall a. (PrettyCode a, NockNatural a) => PrettyCode (Atom a) where
AtomHintNil -> return (annotate (AnnKind KNameConstructor) Str.nil)
AtomHintVoid -> return (annotate (AnnKind KNameAxiom) Str.void)
AtomHintFunctionsPlaceholder -> return (annotate (AnnKind KNameAxiom) Str.functionsPlaceholder)
AtomHintStdlibPlaceholder -> return (annotate (AnnKind KNameAxiom) Str.stdlibPlaceholder)
AtomHintString -> atomToText atm >>= ppCode
instance PrettyCode Text where

View File

@ -690,7 +690,7 @@ compile = \case
FunctionsLibrary -> OpQuote # functionsLibraryPlaceHolder
RawCode -> opAddress "allocClosureFunPath" (fpath <> closurePath RawCode)
TempStack -> remakeList []
StandardLibrary -> OpQuote # stdlib
StandardLibrary -> OpQuote # stdlibPlaceHolder
ClosureTotalArgsNum -> nockNatLiteral farity
ClosureArgsNum -> nockIntegralLiteral (length args)
ClosureArgs -> remakeList args
@ -958,7 +958,7 @@ runCompilerWith opts constrs moduleFuns mainFun = makeAnomaFun
FunctionsLibrary -> ("functionsLibrary-" <> funName) @ functionsLibraryPlaceHolder
RawCode -> ("rawCode-" <> funName) @ c
TempStack -> ("tempStack-" <> funName) @ nockNilHere
StandardLibrary -> ("stdlib-" <> funName) @ stdlib
StandardLibrary -> ("stdlib-" <> funName) @ stdlibPlaceHolder
ClosureTotalArgsNum -> ("closureTotalArgsNum-" <> funName) @ nockNilHere
ClosureArgsNum -> ("closureArgsNum-" <> funName) @ nockNilHere
ClosureArgs -> ("closureArgs-" <> funName) @ nockNilHere
@ -1001,6 +1001,19 @@ runCompilerWith opts constrs moduleFuns mainFun = makeAnomaFun
{ _anomaClosure = mainClosure
}
stdlibPlaceHolder :: Term Natural
stdlibPlaceHolder =
TermAtom
Atom
{ _atomInfo =
AtomInfo
{ _atomInfoLoc = Irrelevant Nothing,
_atomInfoTag = Nothing,
_atomInfoHint = Just AtomHintStdlibPlaceholder
},
_atom = 0 :: Natural
}
functionsLibraryPlaceHolder :: Term Natural
functionsLibraryPlaceHolder =
TermAtom

View File

@ -1022,6 +1022,9 @@ version = "version"
functionsPlaceholder :: (IsString s) => s
functionsPlaceholder = "functionsLibrary_placeholder"
stdlibPlaceholder :: (IsString s) => s
stdlibPlaceholder = "stdlib_placeholder"
theFunctionsLibrary :: (IsString s) => s
theFunctionsLibrary = "the_functionsLibrary"