Git Product home page Git Product logo

cpp-lite's Introduction

cpp-lite

A c-preprocessor like text processor written all in TypeScript

This is not yet started, but I really only need a few capabilities to start:

Usage

cpp-lite -I director -IanotherDir -D DEFINE -DANOTHER_DEF=HOWDY { input.txt } { -o output.txt }

if no input.txt file is specified, will read from stdin. If no -o output.txt file is specified will output to stdout.

Stuff supported

#ifdef FOO
 #define THINGER 1234
  #else
#   ifndef BAR
#     else
#   endif
#endif

#undef MACRO

#include "../file.thing"

#define MACRO BLAH
#define MORE_STUFF blah \
 doSomeStuff(); \
 andEvenMoreStuff()
// NYI:
#define FUNC(a, b...) foo a . FUNC(b)
#define FUNC(a) bar(a)
// NYI;
// You can do some weird stuff with rest params:
#define MYFUNC(a, b..., c, d) first a then c, and d, but don't forget MYFUNC(b)
#define MYFUNC(a, b, c) This forces MYFUNC to only have multiples of 3 parameters

Planned/unplanned Capabilities

  • For (a, b...) b gets the "rest" of the parameters
  • For now, don't use strings & the like, as I'm not going to write a full parser
  • A double back-slash at the end should mean "Put a new line here, but keep the macro going"
  • No token pasting (##a)
  • No string pasting (# a)
  • No #if of any sort
  • No #include <...>
  • No #include "foo\bar" cuz honestly, I use Windows a lot, but that annoys me
  • No #line outputs (at least for now...)

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.