Giter Site home page Giter Site logo

backticks's Introduction

A Transpiler written in Python to convert source code from .bt to .h/.c

Example file test.bt in src dir can be transpiled with ./bt ./src/test.bt command

Backticks source

let num1 = 45;
let num2 = 67.53;

printl(`num1+num2 = {num1+num2}`);

let line = `*`;
let char_count = 0;

printl(`Before:\t{line}`);
loop until char_count < 30 
{
    line += `*`;
    char_count += 1;
}
printl(`After:\t{line}`);

Output

num1+num2 = 112.530000
Before:	*
After:	*******************************

~ Generated C header and source files ~

Header file

#ifndef _TEST_H_
#define _TEST_H_

#include "_bt_inbuilts_.h"

typedef struct
{
long num1;
double num2;
char * line;
long char_count;

} _TEST_H_VARS;

extern _TEST_H_VARS test;

#endif

Source file

#include "test.h"
_TEST_H_VARS test;

int main(int argc, char *argv[])
{
    test.num1 = 45;
    test.num2 = 67.53;
    printf("num1+num2 = %f\n", test.num1 + test.num2);
    test.line = calloc(strlen("*") + 1, sizeof(char));
    strcpy(test.line, "*");
    test.char_count = 0;
    printf("Before:\t%s\n", test.line);
    while (test.char_count < 30)
    {
        test.line = realloc(test.line, (strlen(test.line) + strlen("*")) * sizeof(char));
        strcat(test.line, "*");
        test.char_count += 1;
    }
    printf("After:\t%s\n", test.line);

    return 0;
}

backticks's People

Contributors

schikani avatar

Watchers

 avatar

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.