Menu

Language Features

Relevant source files

This document details the core language constructs, syntax, and capabilities of the OwnLang programming language. The features described here represent the complete syntax and functionality available to OwnLang developers, demonstrated comprehensively in the main example program.

For information about the underlying language processing pipeline, see Language Core. For details about the module system and available libraries, see Module System.

Core Language Constructs

OwnLang provides a rich set of fundamental language constructs that form the foundation for program development. The language supports dynamic typing, first-class functions, and both imperative and functional programming paradigms.

Variable Declaration and Assignment

Variables in OwnLang are dynamically typed and declared through assignment. The language supports multiple assignment patterns and compound operators:

Sources: program.own3-9 program.own220-235

Expression System

The language implements a comprehensive expression system supporting arithmetic, string operations, and boolean logic:

Sources: program.own3-11 program.own34-35

Data Types and Structures

OwnLang supports a variety of built-in data types and provides mechanisms for type introspection and conversion.

Basic Data Types

The type system includes numbers, strings, booleans, arrays, and objects with runtime type checking capabilities:

Sources: program.own106-115

Collection Types

Arrays and objects serve as the primary collection types, supporting both indexed and associative access patterns:

Sources: program.own53-63 program.own82-94 program.own199-205

Control Flow and Functions

OwnLang provides comprehensive control flow constructs and supports both traditional and functional programming approaches.

Control Flow Structures

The language includes standard imperative control flow with enhanced for-loop syntax:

Sources: program.own10-32 program.own96-105

Function System

Functions are first-class values supporting multiple definition styles and functional programming patterns:

Sources: program.own40-49 program.own65-79 program.own162-172 program.own214-218

Advanced Features

OwnLang includes several advanced language features that enable sophisticated programming patterns.

Pattern Matching

The language provides powerful pattern matching capabilities through match expressions:

Sources: program.own162-172 program.own188-197 program.own207-212

Functional Programming

Built-in functional programming primitives support functional composition and data transformation:

Sources: program.own120-133 program.own116-118

Operator Overloading

Custom operators can be defined to extend the language's expression system:

Sources: program.own237-239 program.own90-94

Module Integration

The language provides seamless integration with external modules through the use statement:

Sources: program.own1 program.own106 program.own134 program.own145 program.own243

Error Handling

The language includes error handling mechanisms for robust program execution:

Sources: program.own252-253

The comprehensive feature set demonstrated in the main program file showcases OwnLang's capability as both a scripting language and a platform for complex application development, with particular strength in functional programming paradigms and data manipulation tasks.