Download the PHP package xp-lang/compiler without Composer
On this page you can find all versions of the php package xp-lang/compiler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xp-lang/compiler
More information about xp-lang/compiler
Files in xp-lang/compiler
Package compiler
Short Description XP Compiler
License BSD-3-Clause
Homepage http://xp-framework.net/
Informations about the package compiler
XP Language
XP language is a feature-rich, typed and compiled programming language, based on the popular PHP language and designed to syntactically support features of the XP Framework. The source you write and compile with it can make use of the XP Framework's foundation classes. As the language itself is written in the XP Framework, no binary or proprietary extensions are needed!
Getting started
Like in the XP framework, the entry point is always a class. In their most simple form, these classes have a static main() method. To try it out, create a file called HelloWorld.xp
with the following contents:
Then compile and run it!
Differences
The things you will have noticed are:
- Classes may also have modifiers.
- The
extends Object
is optional and added by the compiler if omitted. - The keyword
function
is gone and replaced by the return type. Because the main() method does not return anything, we use void. - An array type is written as component[]
- Variables still have dollar signs. This makes it easy to spot them, that's why we've decided to keep this!
- Fully qualified classnames are written with dots.
- The object operator is also a dot (at the same time, the string concatenation operator is now the tilde,
~
).
Features
The XP Language features - among others - support for the following:
- Namespaces (which are called packages)
- Imports, static imports and "on-demand" imports (
import util.*;
) - Varargs syntax
- Distinguishable types for arrays and maps
- Class literal
::class
, andfinally
- also for PHP < 5.5! - Properties with
get
andset
, and Indexers - Syntactic support for the following XP Framework features: Typesafe enumerations, Annotations, Generics, the
with
statement and a throws clause
Further reading
To get an overview of XP Language's features, these are good reads:
Developing
In order to change XP Language and/or the Compiler itself, you need to clone this repository, e.g. using Git Read-Only:
Directory structure
Using it
Add that path to your use
setting before the global module path inside your xp.ini
, e.g.:
On Windows systems, use ;
as separator
Enjoy!
Contributing
To contribute, use the GitHub way - fork, hack, and submit a pull request!
All versions of compiler with dependencies
xp-framework/parser Version ^7.0 | ^6.0
xp-framework/tokenize Version ^7.0 | ^6.6
xp-framework/patterns Version ^7.0 | ^6.6
xp-framework/logging Version ^7.0 | ^6.5
xp-framework/collections Version ^7.0 | ^6.5
xp-framework/io-collections Version ^7.0 | ^6.5
php Version >=5.5.0