Low level binary format used by the compiler to store and load various AST and related data.
NB: this is incredibly low level and if you're interested in how the compiler works and less a storage format, you're probably looking for the ic or packed_ast modules to understand the logical format.
RodFile represents a Rod File (versioned binary format), and the associated data for common interactions such as IO and error tracking (RodFileError). The file format broken up into sections (RodSection) and preceded by a header (see: cookie). The precise layout, section ordering and data following the section are determined by the user. See ic.loadRodFile.
create or open - create a new one or open an existingstoreHeader - header infostorePrim or storeSeq - save your stuffclose - and we're doneNow read the bits below to understand what's missing.
Missing Sections: This is a low level API, so headers and sections need to be stored and loaded by the user, see storeHeader & loadHeader and storeSection & loadSection, respectively.
No Error Handling: The API is centered around IO and prone to error, each operation checks or sets the RodFile.err field. A user of this API needs to handle these appropriately.
ASTs, hopes, dreams, and anything as long as it and any children it may have support copyMem. This means anything that is not a pointer and that does not contain a pointer. At a glance these are:
seq[T]
A flag based approach is used where operations no-op in case of a preexisting error and set the flag if they encounter one.
RodFileError = enum ok, tooBig, cannotOpen, ioFailure, wrongHeader, wrongSection, configMismatch, includeFileChanged
RodSection = enum versionSection, configSection, stringsSection, checkSumsSection, depsSection, numbersSection, exportsSection, hiddenSection, reexportsSection, compilerProcsSection, trmacrosSection, convertersSection, methodsSection, pureEnumsSection, toReplaySection, topLevelSection, bodiesSection, symsSection, typesSection, typeInstCacheSection, procInstCacheSection, attachedOpsSection, methodsPerGenericTypeSection, enumToStringProcsSection, methodsPerTypeSection, dispatchersSection, typeInfoSection, backendFlagsSection, aliveSymsSection, sideChannelSection, namespaceSection, symnamesSection
© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/ic/rodfiles.html