Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Anthony Ferrara:
Prefix Trees and Parsers
May 19, 2015 @ 15:13:18

Anthony Ferrara has a new post, following up from his previous look at tries and lexers, continuing along the path to apply what he learned to a HTTP routing system.

In my last post, Tries and Lexers, I talked about an experiment I was doing related to parsing of JavaScript code. By the end of the post I had shifted to wanting to build a HTTP router using the techniques that I learned. Let's continue where we left off...

He starts off with thinking that lexing and parsing the routes out into their respective tokens instead of breaking them up as many do (i.e. splitting on the slashes). He shows the results of this lexing and some parser code to handle these results and turn them into something useful. He did find that the current setup caused a lot of overhead (255 new states per character) so he optimizes the processing with a "default" trie but it was still pretty intensive.

He decided to go a different way at this point, opting for the radix tree structure instead. He includes the implementation of this tree for parsing the routes and his matching lexer updates. Finally he shows how to apply code generation to the results of these changes and how coming back to the "slash splitting" could help...

tagged: lexer parser example prefix tree radixtree route matching slashes

Link: http://blog.ircmaxell.com/2015/05/prefix-trees-and-parsers.html

SitePoint PHP Blog:
The Joy of Regular Expressions [1]
Sep 26, 2006 @ 13:02:45

Sometimes, it's just not enough to sit and try to teach theory about something in programming - it's better to just jump right in and take things as they come. That's what Harry Fuecks thinks, at least in his latest post on the SitePoint PHP Blog - a look at the "Joy of Regular Expressions".

He does go over a bit of the theory and why they are so invaluable, but it's a short section before he gets to the heart of the article - working with regular expressions for:

  • positive matching
  • matching all instances in a given string
  • finding an exact match
  • matching the start of a string
  • validation of the contents of a string
  • checking the length of a string
There's simple examples included for each of the items to help you get an idea of how they'd work.

tagged: regular expression tutorial theory matching length contents regular expression tutorial theory matching length contents

Link:

SitePoint PHP Blog:
The Joy of Regular Expressions [1]
Sep 26, 2006 @ 13:02:45

Sometimes, it's just not enough to sit and try to teach theory about something in programming - it's better to just jump right in and take things as they come. That's what Harry Fuecks thinks, at least in his latest post on the SitePoint PHP Blog - a look at the "Joy of Regular Expressions".

He does go over a bit of the theory and why they are so invaluable, but it's a short section before he gets to the heart of the article - working with regular expressions for:

  • positive matching
  • matching all instances in a given string
  • finding an exact match
  • matching the start of a string
  • validation of the contents of a string
  • checking the length of a string
There's simple examples included for each of the items to help you get an idea of how they'd work.

tagged: regular expression tutorial theory matching length contents regular expression tutorial theory matching length contents

Link:

Tobias Schlitt's Blog:
Comfortable PHP editing with VIM -5-
Aug 23, 2006 @ 14:55:06

Tobias Schlitt has picked by up his "comfortable PHP editing in VIM" series today with this lengthy post with loads of helpful VIM tips to share with PHP developers everywhere.

More than a half year after my last "Comfortable PHP editing with VIM" post, I take up this series again, although I decided to let it die in January. Sadly I did not find any time by now, to extend PDV (the PHP Documentor for VIM plugin) further than it's version 1.0.1, which is available through vim.org and on my SVN. Anyway, I collected a lot of (at least for me) helpful VIM tips, which I'd like to share here

The post contains tons of tips on subjects such as:

  • Find matching brace
  • Indenting and unindeting
  • Emergency help
  • Macros
and many more. For each subject, there's an explaination of a situation you might need it in and, of course, the tip itself. He also links to the earlier parts of the series (one through four) for those wanting to catch up.

tagged: vim easy edit pdv comfortable matching recover regex commands vim easy edit pdv comfortable matching recover regex commands

Link:

Tobias Schlitt's Blog:
Comfortable PHP editing with VIM -5-
Aug 23, 2006 @ 14:55:06

Tobias Schlitt has picked by up his "comfortable PHP editing in VIM" series today with this lengthy post with loads of helpful VIM tips to share with PHP developers everywhere.

More than a half year after my last "Comfortable PHP editing with VIM" post, I take up this series again, although I decided to let it die in January. Sadly I did not find any time by now, to extend PDV (the PHP Documentor for VIM plugin) further than it's version 1.0.1, which is available through vim.org and on my SVN. Anyway, I collected a lot of (at least for me) helpful VIM tips, which I'd like to share here

The post contains tons of tips on subjects such as:

  • Find matching brace
  • Indenting and unindeting
  • Emergency help
  • Macros
and many more. For each subject, there's an explaination of a situation you might need it in and, of course, the tip itself. He also links to the earlier parts of the series (one through four) for those wanting to catch up.

tagged: vim easy edit pdv comfortable matching recover regex commands vim easy edit pdv comfortable matching recover regex commands

Link:


Trending Topics: