CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-swc--core-darwin-arm64

Platform-specific native binary for SWC TypeScript/JavaScript compiler on macOS ARM64 architecture

89

1.15x
Overview
Eval results
Files

task.mdevals/scenario-3/

AST Code Generator

Build a tool that parses JavaScript code into an Abstract Syntax Tree (AST) and then converts the AST back into formatted JavaScript source code.

Capabilities

Parse and Generate Code

  • Parsing the code const x = 5; and printing the resulting AST produces valid JavaScript code @test
  • Parsing the code function add(a, b) { return a + b; } and printing the resulting AST produces valid JavaScript code @test
  • Parsing the code with JSX const elem = <div>Hello</div>; and printing the resulting AST produces valid JSX code @test

Synchronous Operations

  • Using synchronous parsing and printing methods for the code let name = "Alice"; produces the expected output synchronously @test

Implementation

@generates

API

/**
 * Parses JavaScript code to AST and prints it back to source code.
 *
 * @param {string} code - The JavaScript code to parse and print.
 * @returns {Promise<string>} The generated source code.
 */
async function parseAndPrint(code) {
  // IMPLEMENTATION HERE
}

/**
 * Synchronously parses JavaScript code to AST and prints it back to source code.
 *
 * @param {string} code - The JavaScript code to parse and print.
 * @returns {string} The generated source code.
 */
function parseAndPrintSync(code) {
  // IMPLEMENTATION HERE
}

module.exports = {
  parseAndPrint,
  parseAndPrintSync,
};

Dependencies { .dependencies }

@swc/core { .dependency }

Provides fast JavaScript/TypeScript parsing and code generation capabilities.

Install with Tessl CLI

npx tessl i tessl/npm-swc--core-darwin-arm64

tile.json