Skip to content

aliyun/darabonba-python-generator

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published