GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — examples/parse at main · AssemblyScript/examples

Expand file tree

/

parse

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

parse

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
assembly
assembly
 
 
build
build
 
 
src
src
 
 
tests
tests
 
 
README.md
README.md
 
 
index.d.ts
index.d.ts
 
 
index.js
index.js
 
 
index.js.map
index.js.map
 
 
package.json
package.json
 
 
webpack.config.js
webpack.config.js
 
 

README.md

Outline

WebAssembly Parser

An AssemblyScript example. A WebAssembly binary parser in WebAssembly. Small, fast, with TypeScript support.

API

  • parse(binary: Uint8Array, options?: ParseOptions): void
    Parses the contents of a WebAssembly binary according to the specified options.

  • ParseOptions
    Options specified to the parser. The onSection callback determines the sections being evaluated in detail.

    • onSection?(id: SectionId, payloadOff: number, payloadLen: number, nameOff: number, nameLen: number): boolean
      Called with each section in the binary. Returning true evaluates the section.

    • onType?(index: number, form: number): void
      Called with each function type if the type section is evaluated.

    • onTypeParam?(index: number, paramIndex: number, paramType: Type): void
      Called with each function parameter if the type section is evaluated.

    • onTypeReturn?(index: number, returnIndex: number, returnType: Type): void
      Called with each function return type if the type section is evaluated.

    • onImport?(index: number, kind: ExternalKind, moduleOff: number, moduleLen: number, fieldOff: number, fieldLen: number): void
      Called with each import if the import section is evaluated.

    • onFunctionImport?(index: number, type: number): void
      Called with each function import if the import section is evaluated.

    • onTableImport?(index: number, type: Type, initial: number, maximum: number, flags: number): void
      Called with each table import if the import section is evaluated.

    • onMemoryImport?(index: number, initial: number, maximum: number, flags: number): void
      Called with each memory import if the import section is evaluated.

    • onGlobalImport?(index: number, type: Type, mutability: number): void
      Called with each global import if the import section is evaluated.

    • onMemory?(index: number, initial: number, maximum: number, flags: number): void
      Called with each memory if the memory section is evaluated.

    • onFunction?(index: number, typeIndex: number): void
      Called with each function if the function section is evaluated.

    • onGlobal?(index: number, type: Type, mutability: number): void
      Called with each global if the global section is evaluated.

    • onStart?(index: number): void
      Called with the start function index if the start section is evaluated.

    • onExport?(index: number, kind: ExternalKind, kindIndex: number, nameOff: number, nameLen: number): void
      Called with each export if the export section is evaluated.

    • onSourceMappingURL?(offset: number, length: number): void
      Called with the source map URL if the 'sourceMappingURL' section is evaluated.

    • onModuleName?(offset: number, length: number): void
      Called with the module name if present and the 'name' section is evaluated.

    • onFunctionName?(index: number, offset: number, length: number): void
      Called with each function name if present and the 'name' section is evaluated.

    • onLocalName?(funcIndex: number, index: number, offset: number, length: number): void
      Called with each local name if present and the 'name' section is evaluated.

  • Type
    A value or element type, depending on context.

    Name Value
    i32 0x7f
    i64 0x7e
    f32 0x7d
    f64 0x7c
    anyfunc 0x70
    func 0x60
    none 0x40
  • SectionId
    Numerical id of the current section.

    Name Value
    Custom 0
    Type 1
    Import 2
    Function 3
    Table 4
    Memory 5
    Global 6
    Export 7
    Start 8
    Element 9
    Code 10
    Data 11
  • ExternalKind
    Kind of an export or import.

    Name Value
    Function 0
    Table 1
    Memory 2
    Global 3
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.