All Projects → udoprog → Genco

udoprog / Genco

Licence: other
A whitespace-aware quasiquoter for beautiful code generation.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Genco

Scrooge
A Thrift parser/generator
Stars: ✭ 724 (+1127.12%)
Mutual labels:  code-generation
Maple
Elixir GraphQL Client | Compile time client code generator for GraphQL APIs based on introspection queries and schema files
Stars: ✭ 20 (-66.1%)
Mutual labels:  code-generation
Cognicrypt
CogniCrypt is an Eclipse plugin that supports Java developers in using Java Cryptographic APIs.
Stars: ✭ 50 (-15.25%)
Mutual labels:  code-generation
Mappinggenerator
🔄 "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
Stars: ✭ 831 (+1308.47%)
Mutual labels:  code-generation
Go Zero
go-zero is a web and rpc framework written in Go. It's born to ensure the stability of the busy sites with resilient design. Builtin goctl greatly improves the development productivity.
Stars: ✭ 13,156 (+22198.31%)
Mutual labels:  code-generation
Gradle Xjc Plugin
A Gradle plugin to run the XJC binding compiler during a build
Stars: ✭ 38 (-35.59%)
Mutual labels:  code-generation
Tiramisu
A polyhedral compiler for expressing fast and portable data parallel algorithms
Stars: ✭ 685 (+1061.02%)
Mutual labels:  code-generation
Idris Elixir
A code-generator for Idris that targets Elixir
Stars: ✭ 56 (-5.08%)
Mutual labels:  code-generation
Gnostic
A compiler for APIs described by the OpenAPI Specification with plugins for code generation and other API support tasks.
Stars: ✭ 870 (+1374.58%)
Mutual labels:  code-generation
Scala Db Codegen
Scala code/boilerplate generator from a db schema
Stars: ✭ 49 (-16.95%)
Mutual labels:  code-generation
Voucher Code Generator Java
Stars: ✭ 18 (-69.49%)
Mutual labels:  code-generation
Gorram
It's like go run for any go function
Stars: ✭ 932 (+1479.66%)
Mutual labels:  code-generation
Devflowcharter
Flowchart builder and code generator.
Stars: ✭ 41 (-30.51%)
Mutual labels:  code-generation
Graphqlgen
⚙️ Generate type-safe resolvers based upon your GraphQL Schema
Stars: ✭ 796 (+1249.15%)
Mutual labels:  code-generation
Spoon
Spoon is a metaprogramming library to analyze and transform Java source code (up to Java 15). 🥄 is made with ❤️, 🍻 and ✨. It parses source files to build a well-designed AST with powerful analysis and transformation API.
Stars: ✭ 1,078 (+1727.12%)
Mutual labels:  code-generation
Casadi
CasADi is a symbolic framework for numeric optimization implementing automatic differentiation in forward and reverse modes on sparse matrix-valued computational graphs. It supports self-contained C-code generation and interfaces state-of-the-art codes such as SUNDIALS, IPOPT etc. It can be used from C++, Python or Matlab/Octave.
Stars: ✭ 714 (+1110.17%)
Mutual labels:  code-generation
Drupal Console
The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
Stars: ✭ 913 (+1447.46%)
Mutual labels:  code-generation
Pymbolic
A simple package to do symbolic math (focus on code gen and DSLs)
Stars: ✭ 57 (-3.39%)
Mutual labels:  code-generation
Ffcx
Next generation FEniCS Form Compiler
Stars: ✭ 55 (-6.78%)
Mutual labels:  code-generation
Dogen
Reference implementation of the MASD Code Generator.
Stars: ✭ 44 (-25.42%)
Mutual labels:  code-generation

Build Status crates.io docs.rs

genco

A whitespace-aware quasiquoter for beautiful code generation.

Central to genco are the quote! and quote_in! procedural macros which ease the construction of token streams.

This project solves the following language-specific concerns:

  • Imports — Generates and groups import statements as they are used. So you only import what you use, with no redundancy. We also do our best to solve namespace conflicts.

  • String Quoting — genco knows how to quote strings. And can even interpolate values into the quoted string if it's supported by the language.

  • Structural Indentation — The quoter relies on intuitive whitespace detection to structurally sort out spacings and indentation. Allowing genco to generate beautiful readable code with minimal effort. This is also a requirement for generating correctly behaving code in languages like Python where indentation is meaningful.

  • Language Customization — Building support for new languages is a piece of cake with the help of the impl_lang! macro.


To do whitespace detection, we depend on the nightly proc_macro_span feature.

Until this is stabilized, you must build and run projects using genco with a nightly compiler.

cargo +nightly run --example rust

Supported Languages

The following are languages which have built-in support in genco.

Is your favorite language missing? Open an issue!

You can run one of the examples by:

cargo +nightly run --example rust

Rust Example

The following is a simple program producing Rust code to stdout with custom configuration:

use genco::prelude::*;

let hash_map = rust::import("std::collections", "HashMap");

let tokens: rust::Tokens = quote! {
    fn main() {
        let mut m = #hash_map::new();
        m.insert(1u32, 2u32);
    }
};

println!("{}", tokens.to_file_string()?);

This would produce:

use std::collections::HashMap;

fn main() {
    let mut m = HashMap::new();
    m.insert(1u32, 2u32);
}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].