Coder Social home page Coder Social logo

gridaco / coli Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 5.0 2.82 MB

Computer Language Interface. A Code builder (json, jsx, js, ts, dart, css, xml, html, python) AST Builder / Parser

Home Page: https://coli.codes/

License: MIT License

TypeScript 98.94% JavaScript 0.74% Python 0.32%
coli dart css jsx ast asdl tsx es-builder typescript

coli's Introduction

CoLI

Computer Language Interface (node, dart, css, html, python) An AST Builder / Parser

design file available here

Installation

yarn add coli

Supported platforms

  • NodeJS

Builders

Read BUILDERS.md

Supported gen target languages

  • JSX / TSX
  • JS / TS
  • Dart (+ Flutter)
  • CSS
  • SCSS
  • XML
  • HTML

CoLI Node implementation.

jsx building

div(div("content"))

>>> <div>
>>>   <div>
>>>     content
>>>   </div>
>>> </div>

dart variable declaration

const file = new File("main.dart")
file.add(Variable.const("someVariable", "hi there!", CoLITypes.String))

// main.dart
>>> final String someVariable = "hi there!";

to check work around for generating flutter code - checkout @flutter-builder

Function

build function with coli syntax

// 1.

function thisIsNativeFunction() {}

const coliFunc = coli.function(thisIsNativeFunction);

coliFunc.toDart();
// > void thisIsNativeFunction(){}
coliFunc.toPython({ followConvention: true });
// > def this_is_native_function(): ...
coliFunc.toJavascript();
// > function thisIsNativeFunction(){}

// 2.
const coliFunc = new coli.Function({
  returns: coli.Types.void,
  name: "thisIsGeneratedFunction",
  params: {
    first: {
      required: false,
      type: coli.Types.any,
    },
  },
  executable: coli.Executable.fromStatic("console.log('hi there.');"),
});
coliFunc.toJavascript();
// > function thisIsGeneratedFunction(first){ console.log('hi there.'); }

Development

# packs the workspace
yarn
# runs the editor webapp
yarn editor

Building - coli use lerna to build packages. running yarn build will build individual packages.

yarn build

References

coli's People

Contributors

gwonheejun avatar softmarshmallow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

coli's Issues

accents-diacritics & CJK normalization / romanization support

Add native indent support for `stringfy`

Native indenting support when building coli object as a source string.

Ideas

stringfy_internal(o, depth=1){
     stringfy_internal(o.1, depth + 1)
     eachline(o, "\t")
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.