Ďî-đóńńęč
Art.Lebedev Studio presents…
parser


Recent news articlesBirdSome articles from FAQ
[February 24, 2011]  Version 3.4.1 released.

Now Parser3 has native JSON support.

Now Parser3 is able to load files from external HTTP/HTTPS servers using libcurl library.

Now Parser3 tries to search files loaded in @USE/^use[] relatively from the file where these @USE/^use[] are written.

Now user defined methods can handle variable number of parameters: @method[arg;*args] (a hash with numeric keys will be in a variable $args.

Acceptable call types now can be defined for user methods. In meta-command @OPTIONS parameter dynamic or static can be specified (default — any), which will influence to all methods of the file. Particular methods can be declared as statical: @static:method[params].

A special default setter (@SET_DEFAULT[name;value]) can be defined in user classes. This setter will be called during writing to unknown fields of the class/object.

Operator if now can have several «elseif» sections, for example: ^if(a>0){1}(a==0){0}{-1}.

User defined classes do not inherit method @auto[] any longer.

Class void now has all methods available for class string. This means that strings' methods can be called for undefined variable as well.

Class hash now has a new method ^hash._at($index) (or ^hash._at[first|last]) that can be used for accessing element by its index (hashes' elements are ordered since version 3.4.0).

Operator ^apply-taint[[transformation-type]][...] was added. This operator applies inplace transformation to all tainted parts of the string. Parts within undefined transformation type will be processed using specified transformation type (as-is by default).

Method for converting numbers from one base to another was added.

Method ^table.select(...)[options] now supports options $.limit(X) and $.reverse(true|false).

Method ^string.match[...] now can supports four parameters. The value of fourth parameter is returned if nothing was found in the string.

Unknown ^string.match[...] options now cause an exception.

Method ^string:js-unescape[...] now also decodes \uXXXX-encoded symbols.

Constructor ^file::base64[encoded] now also supports another format: ^file::base64[text|binary;file-name;enoded[;$.content-type[...]]].

An option $.content-type[...] now can be specified during creation of file's object.

Method ^reflection:copy[$src;$dest] was added.

Options $.encloser[#] and $.separator[#] now switch the automatics comments removing off while loading table or file.

Parser3 now ignores white-space characters that are written between methods' definitions.

Parser3 now ignores trailing white-space characters in @META commands (@USE, @CLASS, @BASE, @OPTIONS) and their values.

Unsafe Parser3 version do not have restrictions to environment variable names passed to executed scripts any longer.

The third option of method ^image.replace(color-from;color-to)[poligon] is not compulsory any longer. If not specified the color will be replaced in whole image.

A text file, which is loaded without $.charset option specified, that contains a BOM code, will be transcoded from UTF-8 to $request:charset automatically.

In a field $.inherited method ^reflection:method_info[class-name;method-name] now returns the name of class where the method is actually defined.

In a field $.overridden method ^reflection:method_info[class-name;method-name] now returns the name of ancestor's class where the overridden method is defined.

In a field $.file method ^reflection:method_info[class-name;method-name] now returns the full file specification where the method is defined.

Using $request:post-body now it is possible to get POST-request body as a file.

Latest versions of libraries are included: PCRE (8.12) and libxml2 (2.7.8).

A number of bugs were fixed.



What is Parser?
Parser is a simple and convenient object-oriented language, which allows creating good sites in short time. It is a little more complicated than HTML, but requires no special programming skills. Parser was started in Art. Lebedev studio in 1997. Nowadays, most of sites created by Art. Lebedev studio are made with Parser.

What is it for, anyway?
Language is designed and optimized in such a way that it would be more convenient to create good sites. Language supports working with forms, cookies, table files, databases, and XML. Support for user operators and classes allows to extend its functionality.

There is PHP, what Parser is for?
PHP is a programming language requiring appropriate training. Parser can be successfully used by non-professional programmers. Parser is especially good in that it allows mere mortals to create and maintain complex dynamic sites without spending too much time.

I programmed in other languages, in short, what is so convenient in Parser?
Parser is, among other things, a macro-language. It has no print operator; all the code in source file is, in fact, a big print operator. Parser syntax is immersed into text. That is, you do not write program that outputs text. On the contrary, you add logic to already existing text, ^if(condition){action}, and organize it by splitting HTML-code into blocks like:

@header[]

...
@footer[]
...
@navigation[]
...
@body[]
...

My browser displays Parser code, not its result. What's wrong (I am using Apache web-server)?
Parser is not assigned as a handler of your documents after all.
To test whether Parser itself works, type this in your browser's address line:
http://your_site/cgi-bin/parser3.cgi (or .exe, for Win32 version) You should see something like this:

Parser/3.x.x
If you can see it, that means Parser is uploaded where it should have been, and its rights are set correctly.

If you have uploaded parser correctly, and you have not forgotten to put directives specified in documentation to .htaccess, you may have forgotten to allow Apache to process .htaccess in httpd.conf file by directive AllowOverride (see Apache documentation). To check whether .htaccess is processed, put there some arbitrary wrong instruction, say «mytest», to the very beginning of it. If, after page reload you do NOT see 500 error (which must appear if you configured everything right), that means you have .htaccess file ignored. Change AllowOverride directive or turn to your administrator.



Parser 3—simple and convenient object-oriented language which allows creating good sites in short time.

  • XML, XSL, XPath and DOM support
  • Available in documented source code
  • Uniformed database support
  • Support of object-oriented programmers
  • Detailed language documentation (160 pages!)
  • UTF-8 support