PHP Grammer added to leds, and how to build leds
Published 2006-11-13 14:46:00
I've spend quite a bit of time working on leds, specifically focusing on the autocompletion and help implementation for D and PHP, while the D is still ahead, in terms of cross file lookup, autocompletion and display of docbook comments, PHP is beginning to catch up.
The major part of autocompletion for PHP is dealing with the grammer parser (as I blogged before that I had done a pretty much perfect tokenizer). For this I took alot of inspiration from the D parser in dante. Which used for me, anyway, a rather creative method of parsing the language into Components.
In principle it breaks the language down into simple parts
The result is a very simple to write grammer parser, that can be grown organically, rather than the classic grammer parser that depends on the need to fully document every pattern in the language.
When I originally started this post, it was intended as install instructions for leds. which are included in the extended body. And also partly as a reference for me to get it up and going quickly on other machines. The documentation uses Makefiles (as you would use with C), however, after having chatted to Antonio Moneiro, the original author of leds, he had been working on a compile tool (compd).
This compile tool negated the need for makefiles, as it basically worked out what commands to run to build an application, by just being given the files to build, binary library paths and source library paths (bit like .h files in C)
This solved alot of the issues which the rather hacked together makefiles creates, but didnt solve the major problem. That you need to install the libraries in specific places, or modify the build command to help it find the libraries. eg. leds, uses libraries dantefw, dool, dui (GTK) and has to know where you have built those libraries, and where the source is.
So with a little bit of hacking, I added code to the build tool, such that when it has built the library, it writes a list of file paths and dependant libraries to either ~/.compd/{libname}.compd or /etc/compd/{libname}.compd.
Then for example when building leds, you just tell it that you need -ldantefw, it will look in /etc/compd/libdantefw, and find where you compiled the library to, and all the include paths. - hence you no longer need to specify paths anymore, and applications and libraries just build. without editing make files or using autoconf.
In addition we are still discussing how we can make it run more like "make", where it picks up a file in the current working directory, and uses that as it's arguments. so making leds would be as simple as typing "compd", or "compd -f leds.compd"
The major part of autocompletion for PHP is dealing with the grammer parser (as I blogged before that I had done a pretty much perfect tokenizer). For this I took alot of inspiration from the D parser in dante. Which used for me, anyway, a rather creative method of parsing the language into Components.
In principle it breaks the language down into simple parts
- files
- classes
- methods
- codeblock (code inbetween { and })
- statements something ending in ";" ,or "while ( ) { }" (which is a statement with a codeblock)
The result is a very simple to write grammer parser, that can be grown organically, rather than the classic grammer parser that depends on the need to fully document every pattern in the language.
When I originally started this post, it was intended as install instructions for leds. which are included in the extended body. And also partly as a reference for me to get it up and going quickly on other machines. The documentation uses Makefiles (as you would use with C), however, after having chatted to Antonio Moneiro, the original author of leds, he had been working on a compile tool (compd).
This compile tool negated the need for makefiles, as it basically worked out what commands to run to build an application, by just being given the files to build, binary library paths and source library paths (bit like .h files in C)
This solved alot of the issues which the rather hacked together makefiles creates, but didnt solve the major problem. That you need to install the libraries in specific places, or modify the build command to help it find the libraries. eg. leds, uses libraries dantefw, dool, dui (GTK) and has to know where you have built those libraries, and where the source is.
So with a little bit of hacking, I added code to the build tool, such that when it has built the library, it writes a list of file paths and dependant libraries to either ~/.compd/{libname}.compd or /etc/compd/{libname}.compd.
Then for example when building leds, you just tell it that you need -ldantefw, it will look in /etc/compd/libdantefw, and find where you compiled the library to, and all the include paths. - hence you no longer need to specify paths anymore, and applications and libraries just build. without editing make files or using autoconf.
In addition we are still discussing how we can make it run more like "make", where it picks up a file in the current working directory, and uses that as it's arguments. so making leds would be as simple as typing "compd", or "compd -f leds.compd"
Building leds' the current way.
#required packages - debian
apt-get install subversion
apt-get install libstdc++5
#get all the components
cd /usr/src/
wget http://ftp.digitalmars.com/dmd.zip
svn co http://svn.dsource.org/projects/dui/trunk dui
svn co http://svn.dsource.org/projects/dantfw/trunk Dante
svn co http://svn.dsource.org/projects/dool/trunk dool
svn co http://svn.dsource.org/projects/leds/trunk leds
unzip dmd.zip
#install dmd all over the place!
ln -s /usr/src/dmd /
ln -s /dmd/lib/libphobos.a /usr/lib/
ln -s /dmd/bin/dmd /usr/bin/
ln -s /dmd/src/phobos /usr/include/
echo "[Environment]" > /etc/dmd.conf;
echo "DFLAGS=-I/dmd/src/phobos" >> /etc/dmd.conf
chmod +x /dmd/bin/dmd
#install dool
cd /usr/src/dool/
rm Makefile.Dool
wget http://devel.akbkhome.com/leds/Makefile.Dool
make -f Makefile.Dool
#install dui (GTK)
cd ../dui/
rm Makefile.Duit
wget http://devel.akbkhome.com/leds/Makefile.Duit
make -f Makefile.Duit duit
#install dante (parser lib)
cd ../Dante/
rm Makefile.Dante
wget http://devel.akbkhome.com/leds/Makefile.Dante
make -f Makefile.Dante
#install leds (The editor)
cd ../leds/
rm Makefile.Leds
wget http://devel.akbkhome.com/leds/Makefile.Leds
make -f Makefile.Leds
cp ./downloads/libscintilla.so.1.6.3 /usr/lib/libscintilla.so
cp leds /usr/bin/
leds
Rebuilding Leds (updating the code)
#update dmd (optional)
cd /usr/src/
rm dmd.zip
wget http://ftp.digitalmars.com/dmd.zip
unzip dmd.zip
chmod +x /dmd/bin/dmd
#install dool
cd /usr/src/dool/
svn up
rm Makefile.Dool
wget http://devel.akbkhome.com/leds/Makefile.Dool
make -f Makefile.Dool
#install dui (GTK)
cd /usr/src/dui/
svn up
rm Makefile.Duit
wget http://devel.akbkhome.com/leds/Makefile.Duit
make -f Makefile.Duit duit
#install dante (parser lib)
cd /usr/src/Dante/
svn up
rm Makefile.Dante
wget http://devel.akbkhome.com/leds/Makefile.Dante
make -f Makefile.Dante
#install leds (The editor)
cd /usr/src/leds/
svn up
rm Makefile.Leds
wget http://devel.akbkhome.com/leds/Makefile.Leds
make -f Makefile.Leds
cp leds /usr/bin/
leds
Building leds' with compd (currently under development)
#required packages - debianand Rebuilding is just a matter of svn up, and running compd again.!
apt-get install subversion
apt-get install libstdc++5
#get all the components
cd /usr/src/
wget http://ftp.digitalmars.com/dmd.zip
svn co http://svn.dsource.org/projects/dui/trunk dui
svn co http://svn.dsource.org/projects/dantfw/trunk Dante
svn co http://svn.dsource.org/projects/dool/trunk dool
svn co http://svn.dsource.org/projects/leds/trunk leds
unzip dmd.zip
#install dmd all over the place!
ln -s /usr/src/dmd /
ln -s /dmd/lib/libphobos.a /usr/lib/
ln -s /dmd/bin/dmd /usr/bin/
ln -s /dmd/src/phobos /usr/include/
echo "[Environment]" > /etc/dmd.conf;
echo "DFLAGS=-I/dmd/src/phobos" >> /etc/dmd.conf
chmod +x /dmd/bin/dmd
#install dool
cd /usr/src/dool/
#build compd - and installs it into /usr/local/bin/compd
sh compd.sh
compd
#install dui (GTK)
cd ../dui/
compd
#install dante (parser lib)
cd ../Dante/
compd
#install leds (The editor)
cd ../leds/
compd
cp ./downloads/libscintilla.so.1.6.3 /usr/lib/libscintilla.so
cp leds /usr/bin/
leds
Mentioned By:
google.com : november (65 referals)
google.com : april (60 referals)
www.planet-php.net : Planet PHP (25 referals)
google.com : php grammer (18 referals)
google.com : make a dool (9 referals)
google.com : Grammer PHP (8 referals)
google.com : google grammer (6 referals)
google.com : make dool (6 referals)
google.com : how to install LEDs (5 referals)
google.com : DUI gtk (4 referals)
google.com : make up dool (4 referals)
google.com : wget dante (4 referals)
google.com : gramer php (3 referals)
google.com : Grammer (3 referals)
google.com : grammer alot of (3 referals)
google.com : how to build leds (3 referals)
google.com : libscintilla (3 referals)
akbkhome.com : AKBK home - Smoking toooooo much PHP (3 referals)
planet.debian.org.hk : Debian HK : Debian @ Hong Kong (2 referals)
google.com : "grammer" "PHP" (2 referals)
google.com : november (65 referals)
google.com : april (60 referals)
www.planet-php.net : Planet PHP (25 referals)
google.com : php grammer (18 referals)
google.com : make a dool (9 referals)
google.com : Grammer PHP (8 referals)
google.com : google grammer (6 referals)
google.com : make dool (6 referals)
google.com : how to install LEDs (5 referals)
google.com : DUI gtk (4 referals)
google.com : make up dool (4 referals)
google.com : wget dante (4 referals)
google.com : gramer php (3 referals)
google.com : Grammer (3 referals)
google.com : grammer alot of (3 referals)
google.com : how to build leds (3 referals)
google.com : libscintilla (3 referals)
akbkhome.com : AKBK home - Smoking toooooo much PHP (3 referals)
planet.debian.org.hk : Debian HK : Debian @ Hong Kong (2 referals)
google.com : "grammer" "PHP" (2 referals)
Follow us
-
- Some thoughts on the language server and its usefulness in the roobuilder
- Roo Builder for Gtk4 moving forward
- Clustered Web Applications - Mysql and File replication
- GitLive - Branching - Merging
- PDO_DataObject Released
- PDO_DataObject is under way
- Mass email Marketing and anti-spam - some of the how-to..
- Hydra - Recruitment done right
Blog Latest
-
Twitter - @Roojs