Core Module

The Language::Core module provides primitive types and interfaces that form the foundation of every XXML program.

xxml
#import Language::Core;

Integer

64-bit signed integer type with full arithmetic and comparison support.

Constructors

MethodParametersReturnsDescription
ConstructorInteger^Creates integer with value 0
Constructorval: NativeType<"int64">%Integer^Creates integer from native int64

Arithmetic Operations

MethodParametersReturnsDescription
addother: Integer&Integer^Returns sum of this and other
subtractother: Integer&Integer^Returns difference
multiplyother: Integer&Integer^Returns product
divideother: Integer&Integer^Returns quotient
moduloother: Integer&Integer^Returns remainder
negateInteger^Returns negated value
absInteger^Returns absolute value

Assignment Operations

MethodParametersReturnsDescription
addAssignother: Integer&Integer^Adds and assigns
subtractAssignother: Integer&Integer^Subtracts and assigns
multiplyAssignother: Integer&Integer^Multiplies and assigns
divideAssignother: Integer&Integer^Divides and assigns
moduloAssignother: Integer&Integer^Modulo and assigns

Comparison Operations

MethodParametersReturnsDescription
equalsother: Integer&Bool^Tests equality
lessThanother: Integer&Bool^Tests if less than
greaterThanother: Integer&Bool^Tests if greater than
lessOrEqualother: Integer&Bool^Tests if less or equal
greaterOrEqualother: Integer&Bool^Tests if greater or equal

Conversion

MethodParametersReturnsDescription
toInt64NativeType<"int64">%Returns raw int64 value
toInt32NativeType<"int32">^Returns as int32
toStringString^Converts to string representation
hashNativeType<"int64">^Returns hash code (Hashable)
xxml
Instantiate Integer^ As <a> = Integer::Constructor(10);
Instantiate Integer^ As <b> = Integer::Constructor(3);

Instantiate Integer^ As <sum> = a.add(b);           // 13
Instantiate Integer^ As <product> = a.multiply(b);  // 30
Instantiate Integer^ As <absolute> = a.negate().abs(); // 10

Run System::Console::printLine(sum.toString());

String

Owned string type with memory management. Marked as Compiletime Final.

Constructors

MethodParametersReturnsDescription
ConstructorString^Creates empty string
Constructorcstr: NativeType<"cstr">%String^Creates from C string literal
FromCStringptr: NativeType<"ptr">String^Creates from pointer

Properties & Access

MethodParametersReturnsDescription
lengthInteger^Returns character count
isEmptyBool^Returns true if length is 0
charAtindex: Integer&String^Returns character at index
toCStringNativeType<"cstr">%Returns raw C string pointer

Operations

MethodParametersReturnsDescription
appendother: String&String^Concatenates strings
copyString^Creates a deep copy
equalsother: String&Bool^Tests string equality
hashNativeType<"int64">^Returns hash code
disposeNoneFrees underlying memory
xxml
Instantiate String^ As <greeting> = String::Constructor("Hello");
Instantiate String^ As <name> = String::Constructor("World");

Instantiate String^ As <message> = greeting.append(String::Constructor(", ")).append(name);
Instantiate Integer^ As <len> = message.length();

If (message.isEmpty().not().toBool())
{
    Run System::Console::printLine(message);
}

Bool

Boolean type representing true or false values.

Constructors

MethodParametersReturnsDescription
ConstructorBool^Creates false value
Constructorval: NativeType<"bool">%Bool^Creates from native bool

Logical Operations

MethodParametersReturnsDescription
andother: Bool&Bool^Logical AND
orother: Bool&Bool^Logical OR
notBool^Logical NOT
xorother: Bool&Bool^Exclusive OR

Comparison & Conversion

MethodParametersReturnsDescription
equalsother: Bool&Bool^Tests equality
toBoolNativeType<"bool">%Returns raw boolean
getValueNativeType<"bool">%Alias for toBool
toIntegerInteger^Returns 1 for true, 0 for false
xxml
Instantiate Bool^ As <a> = Bool::Constructor(true);
Instantiate Bool^ As <b> = Bool::Constructor(false);

Instantiate Bool^ As <result> = a.and(b);     // false
Instantiate Bool^ As <either> = a.or(b);      // true
Instantiate Bool^ As <negated> = a.not();     // false

If (a.toBool())
{
    Run System::Console::printLine(String::Constructor("a is true"));
}

Float

32-bit single-precision floating point number.

Constructors

MethodParametersReturnsDescription
ConstructorFloat^Creates 0.0 value
Constructorval: NativeType<"float">%Float^Creates from native float

Arithmetic Operations

MethodParametersReturnsDescription
addother: Float&Float^Addition
subtractother: Float&Float^Subtraction
multiplyother: Float&Float^Multiplication
divideother: Float&Float^Division
negateFloat^Negation
absFloat^Absolute value

Comparison

MethodParametersReturnsDescription
equalsother: Float&Bool^Tests equality
lessThanother: Float&Bool^Less than comparison
greaterThanother: Float&Bool^Greater than comparison

Conversion

MethodParametersReturnsDescription
toFloatNativeType<"float">%Returns raw float
toIntegerInteger^Converts to Integer (truncates)
toDoubleDoubleConverts to Double
toStringString^String representation

Double

64-bit double-precision floating point number.

Constructors

MethodParametersReturnsDescription
ConstructorDouble^Creates 0.0 value
Constructorval: NativeType<"double">%Double^Creates from native double

Arithmetic Operations

MethodParametersReturnsDescription
addother: Double&Double^Addition
subtractother: Double&Double^Subtraction
multiplyother: Double&Double^Multiplication
divideother: Double&Double^Division
negateDouble^Negation
absDouble^Absolute value

Comparison

MethodParametersReturnsDescription
equalsother: Double&Bool^Tests equality
lessThanother: Double&Bool^Less than
greaterThanother: Double&Bool^Greater than
lessOrEqualother: Double&Bool^Less or equal
greaterOrEqualother: Double&Bool^Greater or equal

Conversion

MethodParametersReturnsDescription
toDoubleNativeType<"double">%Returns raw double
getValueNativeType<"double">%Alias for toDouble
toIntegerInteger^Converts to Integer
toFloatFloatConverts to Float
toStringString^String representation
xxml
Instantiate Double^ As <pi> = Double::Constructor(3.14159265359);
Instantiate Double^ As <radius> = Double::Constructor(5.0);

Instantiate Double^ As <area> = pi.multiply(radius).multiply(radius);
Run System::Console::printLine(area.toString());

Hashable

Constraint interface for types that can be used as HashMap keys or Set elements.

Types implementing Hashable must provide a hash() method that returns a consistent integer value for the same object.

xxml
[ Constraint <Hashable> <T Constrains None>
    Method <hash> Returns NativeType<"int64">^ Parameters ()
]

Note

Hash implementations must be deterministic—calling hash() multiple times on the same object must return the same value. Built-in types like Integer andString already implement this constraint.

Equatable

Constraint interface for types that support equality comparison.

Types implementing Equatable must provide an equals() method. Required for HashMap key comparison and general equality testing.

xxml
[ Constraint <Equatable> <T Constrains None>
    Method <equals> Returns Bool^ Parameters (Parameter <other> Types NativeType<"ptr">^)
]

Note

Equality implementations should be reflexive (x.equals(x) is true), symmetric (x.equals(y) implies y.equals(x)), and transitive.

Complete Example

core_example.xxml
1#import Language::Core;
2#import Language::System;
3
4[ Entrypoint
5 {
6 // Integer arithmetic
7 Instantiate Integer^ As <x> = Integer::Constructor(42);
8 Instantiate Integer^ As <y> = Integer::Constructor(8);
9 Instantiate Integer^ As <sum> = x.add(y);
10
11 // Floating point
12 Instantiate Double^ As <pi> = Double::Constructor(3.14159);
13 Instantiate Double^ As <squared> = pi.multiply(pi);
14
15 // String operations
16 Instantiate String^ As <result> = String::Constructor("Result: ");
17 Set result = result.append(sum.toString());
18
19 // Boolean logic
20 Instantiate Bool^ As <isPositive> = x.greaterThan(Integer::Constructor(0));
21
22 If (isPositive.toBool())
23 {
24 Run System::Console::printLine(result);
25 }
26
27 Exit(0);
28 }
29]

See Also