GithubHelp home page GithubHelp logo

isabella232 / lex-pass Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookarchive/lex-pass

0.0 0.0 0.0 510 KB

manipulate a php codebase using haskell to transform the abstract-syntax-tree

Home Page: http://developers.facebook.com/

License: BSD 3-Clause "New" or "Revised" License

Haskell 98.86% Shell 0.30% Perl 0.84%

lex-pass's Introduction

Archived Repo
-------------
This is an archived project and is no longer supported or updated by Facebook. 
Please do not file issues or pull-requests against this repo. If you wish to 
continue to develop this code yourself, we recommend you fork it.

-------------

Mailing list at: http://groups.google.com/group/lex-pass

lex-pass allows you to automate changes to a php codebase, by writing
abstract-syntax-tree transformers in haskell.  haskell is good because it is
well-suited for language manipulation and because it has good parsing libraries
that enable us to work with a nice abstract-syntax-tree.

to install
- ./install
depends on
- futil (git://github.com/facebook/futil.git)

to use
- run `lex-pass` to see options
- to see an example run, run `lex-pass example-global` with a codebase in
  ~/www that uses some globals (e.g. "global $a;")
  - note a large codebase could takes tens of minutes the first run because no
    ast's are cached yet
  - you can ^C it early after it does 'Saving' on a few files to see how the
    changes work
- to write a new transformer
  - see src/Transf/ for examples
  - src/do-codegen (which is run by ./install) automatically detects new
    transformers in src/Transf/
- if you are using git you may want to use a separate repo instead of just a
  branch in an existing repo.  files have mtime updated by branch-switching,
  so there will be some unnecessary re-parsing.

notes for those hacking on lex-pass itself
- todo
  - php: b'' type string literals
  - maintain cached asts for codebase somewhere so ppl don't have to wait on
    their first lex-pass run?
  - better error on one-arg transf's if args wrong?
  - better way to specify args in transf doc?
  - make showing full transf list an option instead of default help?
  - we might actually get better perf with our own lexer, or at least not
    restarting php over and over again to do lexing.  but not worth looking
    into any time soon?
  - resolve xWs/xWS, xAst/xAST variable-capitalization indecision
  - future langs
    - css - easy and relevant, but maybe a css-preprocessor is better to use
    - js  - relevant
    - bash (we should probably just stop using..), c, python

lex-pass's People

Contributors

dancor avatar arvidj avatar jamesgpearce avatar tdudziak avatar slyphon 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.