Skip to content
This repository has been archived by the owner on Sep 9, 2019. It is now read-only.
Timm Friebe edited this page Jun 2, 2013 · 7 revisions
Welcome to the XP Language Wiki.

What is XP Language?

XP Language is easy to start with for people coming from a PHP background. It's built on top of the excellent XP Framework and extends its functionality by supportive syntax. XP Language is object-oriented and feature-rich, supporting multiple styles of expressing yourself. XP Language is open to be compiled to various output formats. Currently the compiler offers production-ready support for emitting PHP sourcecode. The XP Compiler tracks types for all expressions, and can warn about potentially unsafe operations such as invoking non-existant methods.

Hello World

Here's the typical hello world program written in XP Language and how it's compiled and run:

```groovy public class HelloWorld { public static void main(string[] $args) { util.cmd.Console::writeLine('Hello World!'); } } ``` ```sh $ xcc HelloWorld.xp # [...]

$ xp HelloWorld Hello World!

</td></tr></table>

Getting started
--
In order to use XP Language, you need PHP and the XP Framework on your computer. [Once that is done](https://github.com/xp-framework/xp-framework/wiki/setup.framework), you can use the XP Installer:

1. Create a path in your home directory for globally available XP Modules. Let's use `~/.xp` for our example.
2. Add this path to the `use` directive in your `xp.ini`, using the path separator (`:` on Un*x, `;` on Windows)`use=/path/to/xp/core:~/.xp`).
3. Open a shell window, go to this directory and then type `xpi add xp-lang/compiler`

You will now have the `xcc` command available from any path.

The language itself
--
Now that you're all set to go, start learning the language:

TODO: These topics need to be created and filled with life!


* [Basic syntax overview](wiki/syntax)
  Primitives, arrays and maps and their literals, classes, interfaces, enums, their members, conditionals, loops, exceptions and operators.
* [Class members](wiki/classmembers)
  Self, parent and this, constructors, methods, fields, properties, compact syntax, static initializers, static members, array operations on objects with indexers.
* [Organizing code](wiki/packages)
  Packages and imports, import on demand.
* [Generics](wiki/generics)
  Working with generic types: Declaration and usage.
* [Native functions](wiki/native)
  Using the underlying runtimes functionality such as `array_merge()` directly.
* [Functional programming](wiki/closures)
  Closures vs. annymous class instances.

For contibutors
--
[Building a release](wiki/building-a-release)
Clone this wiki locally