Giter Site home page Giter Site logo

pbiggar / phc Goto Github PK

View Code? Open in Web Editor NEW
128.0 128.0 37.0 20.99 MB

A compiler for PHP

PHP 31.76% C++ 40.50% C 9.98% Java 1.75% Shell 9.25% JavaScript 0.01% Perl 0.09% Tea 0.51% Makefile 3.03% HTML 0.47% Awk 0.12% SourcePawn 0.08% XSLT 0.01% GDB 0.01% M4 1.83% Lex 0.32% Yacc 0.25% Hack 0.01%

phc's Introduction

Ceasefire Now

Hi there ๐Ÿ‘‹

Software engineer and devtools founder -- founded Tech For Palestine, CircleCI and Darklang.

Irish, based in NYC after a decade in SF.

Functional languages, devtools, progressive politics, tech, pastries. Recurser. (he/him)

Feel free to reach out for advice on startups, devtools, or programming: [email protected]

Tech For Palestine

Inexplicably I now help lead a Palestinian advocacy org called Tech For Palestine, which I founded with a core group of about 40 others.

Darklang

I've been working on Darklang since late 2016. I'm taking a hiatus to work on Tech For Palestine. You can follow that work in various places:

Socials

Past self

I previously was founder and CEO of CircleCI. I wrote a bunch of early stuff on the CircleCI blog, including this piece that I'm extremely proud of.

I also did a PhD in Compilers and Static Analysis, and my research papers are online (also includes some research on sorting algorithms)

phc's People

Contributors

cubathy avatar edsko avatar gavinowens avatar jimmehc avatar kdkd avatar logytech avatar olistudent avatar pbiggar avatar thesin- avatar xuchen-plus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phc's Issues

Add a warning for different token types in maketea

If using one token, such as CAST, in another form as well (CAST<String*>),
that results in a compile error in the generated C++.

Add a warning for this in maketea.

Original issue reported on code.google.com by paul.biggar on 2007-11-09 14:27:43

error: 'struct _zend_function::<anonymous>' has no member named 'return_reference'

using the php from https://github.com/h4ck3rm1k3/php 5.4.4-5

src/embed/optimize.cpp: In static member function 'static Method_info* PHP::get_method_info(String_)':
src/embed/optimize.cpp:223: error: invalid conversion from 'zend_fcall_info_' to 'uint'
src/embed/optimize.cpp:223: error: cannot convert 'zend_fcall_info_cache_' to 'zend_fcall_info_' for argument '3' to 'int
zend_fcall_info_init(zval_, uint, zend_fcall_info_, zend_fcall_info_cache_, char__, char_*)'
src/embed/optimize.cpp: In member function 'virtual bool Internal_method_info::return_by_ref()':
src/embed/optimize.cpp:248: error: 'struct _zend_function::' has no member named 'return_reference'

this is on my branch : https://github.com/h4ck3rm1k3/phc

Allow to output parts of the AST

It'd be nice if users could output parts of the AST to DOT format, perhaps
using some annotation in a comment on the parts that they need.

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:52:13

Test using the non-default gcc compiler (the one from issue 25)

Add a test like CompiledVsInterpreted which uses a different (or number of
different) of options, or different compilers (even if just
/usr/bin/gcc-4.1 instead of just gcc).

Original issue reported on code.google.com by paul.biggar on 2007-04-24 19:59:52

Can't link against ...what?

Hello there.

I just tried to configure phc, but I got this at the last of my config-output:

checking whether the Boost::Regex library is available... yes
configure: error: Could not link against  !

Now, the config.log didnt give me any detail as well... and the configure script confused me by itself. So, how can I figure out what is going on here? o.o

Regards, Ingwie

Dynamic function/class declarations

The lifting pass must be modified to deal with dynamic function and class
declarations.

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:55:41

Add a simple way for users to send bug reports

Add a tool, tentatively called phug, which will create bug_report.tar.gz
from a crash in the compiler, or in compiled code. It would rely on
embedding the command-line to phc in the binary, and would collect relevant
data (uname, php --version, phc --version, etc), including the user's code
for a bug report.

Original issue reported on code.google.com by paul.biggar on 2007-04-14 17:32:59

Allow different C compilers for compiling generated C

Add either a flag for changing the compiler or check the CC var.
This compiler is the one which compiles generated C code. This could be
ccache, for example, so we need to support something like

phc --c-compiler "ccache gcc".

Whether we use a flag or CC should be made consistant with CFLAGS vs
--c-option.

Original issue reported on code.google.com by paul.biggar on 2007-04-24 19:58:06

Add some verification to the examples in the tutorials

We currently compile the turorial plugins, but we dont automatically check
that they work. I dont know how we'll do this, but its a good idea.

Original issue reported on code.google.com by paul.biggar on 2007-06-04 15:42:30

Fix line numbers

The line numbers reported by phc are not always accurate, and many nodes in
the AST don't have a line number associated with them at all. We should
probably use Bison's location tracking for this (that may also make
tracking of comments easier).

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:45:31

g++-4.6: error: unrecognized option '-R'

after I build it using ./configure --prefix=/opt/phc-0.3.0.1/ --with-php=/opt/php-5.3.17/ --with-boost I get following error in the config.log file.

configure:16928: g++ -o conftest -g -O2   conftest.cpp /usr/lib/libCrun.so.1 -lphp5 -L/opt/php-5.3.17//lib -R/opt/php-5.3.17//lib -ldl  >&5
g++-4.6.real: error: /usr/lib/libCrun.so.1: No such file or directory
g++-4.6.real: error: unrecognized option '-R'

This is the configure error I get.

checking for sapi/embed/php_embed.h... yes
checking whether compiler supports covariant returns... yes
checking for /usr/lib/libCrun.so.1... no
checking for boostlib >= 1.35.0... yes
checking whether the Boost::Regex library is available... yes
configure: error: Could not link against  !

Get the garbage collector working

The assumption in phc is that we use a garbage collector, so we never free
anything anywhere. Unfortunately, the garbage collector is disabled by
default because it crashes phc :-)

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:48:17

Schema generation

At the moment, maketea does not generate a schema, and phc ships without an
XML schema. 

Original issue reported on code.google.com by edskodevries on 2007-06-03 09:28:09

man-page

We should write a small man-page to be distributed with phc that explains
the basics. 

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:49:56

Don't unparse inline HTML as an echo

hi
<?php 
  echo "there";
?>

should not be unparsed as

<?php
  echo "hi";
  echo "there";
?>

Original issue reported on code.google.com by edskodevries on 2007-11-10 17:15:01

Support behaviour of old versions of php

For example, 5.2.1 and 5.2.0 have different behaviour regarding the value
of ints near INT_MAX. It could use a simple database, or could query with
an embedded php runtime, or some combination of both.

Original issue reported on code.google.com by paul.biggar on 2007-04-14 17:35:41

support php.ini

Most variables in php.ini are related to the standard library (list here
http://ie.php.net/manual/en/ini.php#ini.list). Some, however, relate to the
way php executes. Some of these can be updated by ini_set, and some cant.
Some are affected by safe mode, and some cant.

A simple way to handle this may be to wrap each call to ini_set (if we dont
know the setting being updated) and update part of our run-time with that
info. This could even extend to dynamic calls.

Original issue reported on code.google.com by paul.biggar on 2007-05-24 10:39:22

Make compilation of user scripts platform independent

Right now we hard code the gcc command line from within phc.cpp. Meanwhile,
our build framework uses libtool to handle complicated multi-platform
problems which we dont even understand. If we compiled user code using
libtool, perhaps multi-platform problems could be avoided

Original issue reported on code.google.com by paul.biggar on 2007-05-13 10:13:11

Comments associated with "else"

If an if-statement has a comment associated with the else part

if(..)
{

}
// do something else
else
{
  ..
}

that comment is associated with the first statement inside the else, instead:

if(..)
{
  ..
}
else
{
  // do something else
  ..
}


Original issue reported on code.google.com by edskodevries on 2007-04-14 15:53:41

Shred list-assignments

List assignment can be used to assign the various elements of an array to
individual variables. From the PHP manual:

-------

void list ( mixed $varname, mixed $... )

Like array(), this is not really a function, but a language construct.
list() is used to assign a list of variables in one operation.

Note: list() only works on numerical arrays and assumes the numerical
indices start at 0. 

-------

Hence, I think every list assignment can be translated into a normal
assignment (to a temporary), and then a number of array indices:

list($a, $b, $c) = array(1,2,3);

translates to

$T = array(1,2,3);
$c = $T[2];
$b = $T[1];
$a = $T[0];

(Note that according to the PHP manual, the variables must be assigned in
right-to-left order.)

Not sure exactly what to do with reference assignments - must be careful
about that.


Original issue reported on code.google.com by edskodevries on 2007-05-06 17:57:52

Support locking behaviour of foreach

In the interpreter, foreach uses locks, for a reason im not totally sure
of. Investigate why this is, and support it.

Original issue reported on code.google.com by paul.biggar on 2007-04-24 14:30:16

maketea: Add check_invariant function

check_invarants would be a function you can call from any point in which
you expect the AST to be stable, which checks, for now, that things which
shouldnt be NULL arent. It will also call a check_mixin_invariant function,
which is user defined.

Original issue reported on code.google.com by paul.biggar on 2007-05-14 10:46:01

Manual makefile doesnt use configure

We should add configure checks for jade, docbook-dsssl and jadetex.

Original issue reported on code.google.com by paul.biggar on 2007-04-22 13:49:34

Command line options for plugins

At the moment, plugins have access to the command line options, but they
cannot add their own. This may be difficult to fix though if we want to
keep using gengetopt.

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:44:26

PHP::get_method_info

in my branch again :

src/embed/optimize.cpp: In static member function 'static Method_info* PHP::get_method_info(String_)':
src/embed/optimize.cpp:223: error: invalid conversion from 'zend_fcall_info_' to 'uint'
src/embed/optimize.cpp:223: error: cannot convert 'zend_fcall_info_cache_' to 'zend_fcall_info_' for argument '3' to 'int zend_fcall_info_init(zval_, uint, zend_fcall_info_, zend_fcall_info_cache_, char__, char_*)'

maketea: _init functions are not called anywhere

_init is a function, which, if defined in a .tea file, will be called
during initialization, at the end of a constructor. However, it isnt being
called now.

Original issue reported on code.google.com by paul.biggar on 2007-05-14 10:39:39

maketea doesnt generate line numbers

The generated C++ used to have #line directives, which were removed due to
bugs They should be added back.

Original issue reported on code.google.com by paul.biggar on 2007-11-09 14:28:58

Optional argument for exit

exit has an optional argument which we unparse as exit(0); modify the
grammar or set an attribute on exit.

Original issue reported on code.google.com by edskodevries on 2007-11-10 17:20:16

Fix XML part of maketea

and make the XML parser work again. Should also poke the Xerces people to
finally fix that bug, so we can actually validate XML input.

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:41:02

Consistent naming of command line options

We need to organize the naming conventions for the command line options a
bit better, similar to what ghc or gcc does.

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:26:37

respect the max_execution_time variable

We could use a sigalrm to do this. The problem is whether or not its set
using ini_set. Add to this that ini_set only works in safe_mode, which we
dont exactly support either.

Original issue reported on code.google.com by paul.biggar on 2007-05-24 10:16:41

Int behaviour not in keeping with php 5.2.1

The behaviour of php 5.2.1 regarding integers near INT_MAX is more sensible
than 5.2.0. Default to it.

See also issue 15.

Original issue reported on code.google.com by paul.biggar on 2007-04-14 17:43:03

Add --obfuscate option

..which runs all code generation passes that are PHP->PHP (that is, so far,
lowering and shredding, followed by goto uppering).

Original issue reported on code.google.com by edskodevries on 2007-04-14 15:40:12

source-vs-semantic errors

On my Athlon 64, running 32-bit Linux, I'm still getting two
source-vs-semantic errors

edsko@slash:~/phc/trunk$ cat
test/logs/source_vs_semantic_values/bugs/bug0009.php.log
Command (0): src/phc --run plugins/tests/source_vs_semantic_values.la
test/subjects/bugs/bug0009.php 2>&1 | /opt/php/bin/php -C -d
memory_limit=25M 2>&1
Failure (Token_int): '2147483647' (integer: 2147483647) vs '0x100000000'
(double: 4294967296))
Failure

Command (0): src/phc --run plugins/tests/source_vs_semantic_values.la
test/subjects/bugs/bug0011.php 2>&1 | /opt/php/bin/php -C -d
memory_limit=25M 2>&1
Failure (Token_int): '2147483647' (integer: 2147483647) vs '0x100000000'
(double: 4294967296))
Failure (Token_int): '2147483647' (integer: 2147483647) vs '0x100000001'
(double: 4294967297))
Failure (Token_int): '2147483647' (integer: 2147483647) vs '0x100000002'
(double: 4294967298))
Failure (Token_int): '-2147483647' (integer: -2147483647) vs '-0x100000000'
(double: -4294967296))
Failure (Token_int): '-2147483647' (integer: -2147483647) vs '-0x100000001'
(double: -4294967297))
Failure (Token_int): '-2147483647' (integer: -2147483647) vs '-0x100000002'
(double: -4294967298))
Failure

Original issue reported on code.google.com by edskodevries on 2007-04-14 16:11:40

Omit final closing tag

The source may not have a final closing tag

<?php echo "hi";

is a valid script. Not sure if we want to replicate this though.

Original issue reported on code.google.com by edskodevries on 2007-11-10 17:19:19

Comments are not always unparsed in the right place

This is particularly true when comments are placed inside expressions, like

f(/* 1 */ $a, /* 2 */ $b);

This is a though one though!

Original issue reported on code.google.com by edskodevries on 2007-11-10 17:17:47

Consecutive PHP blocks are unparsed as one

i.e., 

<?php
  echo "hi";
?>
<?php
  echo "there";
?>

is unparsed as

<?php
  echo "hi";
  echo "there";
?>

Not too bothered, though.

Original issue reported on code.google.com by edskodevries on 2007-11-10 17:16:20

Improve the plugin test

We currently check 1 test in just the trunk/ directory. We need to check
the current directory (with or without the ./ prefix), a different
directory, a directory with a very muddied prefix (ie
test/../plugins/.././src/./). We should also need to check each of the
plugins, not just one of them.

Original issue reported on code.google.com by paul.biggar on 2007-05-07 15:39:40

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.