Skip to content

Repository files navigation

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.functionthisIsNativeFunction(){}constcoliFunc=coli.function(thisIsNativeFunction);coliFunc.toDart();// > void thisIsNativeFunction(){}coliFunc.toPython({followConvention: true});// > def this_is_native_function(): ...coliFunc.toJavascript();// > function thisIsNativeFunction(){}// 2.constcoliFunc=newcoli.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

About

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

Topics

Resources

Contributing

Stars

18 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages