@darabonba/python-generator

1.2.18 • Public • Published

English | 简体中文

Darabonba Python Generator

CI codecov NPM version npm download

Installation

Darabonba Code Generator was designed to work in Node.js. The preferred way to install the Generator is to use the NPM package manager. Simply type the following into a terminal window:

npm install @darabonba/python-generator

Usage

'use strict';

const path = require('path');
const fs = require('fs');

const Generator = require('@darabonba/python-generator');
const DSL = require('@darabonba/parser');

const modulePath = '<module path>';
const moduleOutputDir = '<output dir path>';

const teaFile = fs.readFileSync(path.join(modulePath, 'Darafile'), 'utf8');
const main = fs.readFileSync(path.join(modulePath, 'main.dara'), 'utf8');

const pkgInfo = JSON.parse(teaFile);
const config = {
    outputDir: moduleOutputDir,
    pkgDir: modulePath,
    ...pkgInfo
  };
// generate AST data by parser
const ast = DSL.parse(main, path.join(modulePath, 'main.dara'));
// initialize generator
const generator = new Generator(config, 'python');

generator.visit(ast);

Issues

Opening an Issue, Issues not conforming to the guidelines may be closed immediately.

Changelog

Detailed changes for each release are documented in the release notes.

License

Apache-2.0 Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

Dependencies (2)

Dev Dependencies (9)

Package Sidebar

Install

npm i @darabonba/python-generator

Weekly Downloads

22

Version

1.2.18

License

Apache-2.0

Unpacked Size

459 kB

Total Files

178

Last publish

Collaborators

  • aliyunsdkteam
  • yndu13
  • jacksontian
  • pagecao