1.1 Design Principles
The design of Buoy is guided by the following principles.
Readability
Source code is written more often than it is read. Buoy therefore favors clarity and consistency over syntactic brevity.
Simplicity
A language feature should justify its existence. Features that duplicate existing capabilities or introduce unnecessary complexity are avoided.
Strong Static Typing
The compiler should detect programming errors whenever possible before program execution. Type information is used to verify program correctness while remaining unobtrusive through judicious use of type inference.
Explicit Intent
Program structure should communicate programmer intent. Distinct language constructs are used to represent distinct concepts. For example, a Function computes and returns a value, while a Sub performs an action without producing a result.
Orthogonality
Language features should compose naturally. A feature that applies to one category of declaration should, where practical, apply consistently to others. Generic programming is an example of this principle.
Practicality
Buoy is intended for writing real applications. The language favors solutions that are straightforward to understand, implement, and maintain over solutions that are theoretically elegant but difficult to use.
1.2 Scope
This document specifies the Buoy programming language.
It defines:
- lexical structure
- declarations
- the type system
- expressions
- statements
- functions and subroutines
- generic programming
- built-in language constructs
- program execution semantics
This document does not define implementation-specific behaviour unless explicitly stated.
1.3 A First Program
The traditional first program displays the text “Hello, World!” on the standard output stream.
print(“Hello, World!”)
The precise entry point and program structure depend upon the execution model described in Chapter 3.
1.4 Source Files
A Buoy program consists of one or more source files.
A source file contains declarations, executable statements, or both, depending upon the context in which the file is compiled.
The organization of source files into modules, packages, or compilation units is described in a later chapter.
1.5 Case Sensitivity
Unless explicitly stated otherwise, identifiers are case-sensitive.
The identifiers
Value
value
VALUE
represent three distinct identifiers.
The spelling of language keywords is fixed.
1.6 Language Evolution
The Buoy language is expected to evolve over time.
New language features may be introduced in future language revisions while preserving source compatibility whenever practical.
When compatibility cannot be preserved, the language specification shall identify the behavioural changes introduced by the newer revision.
1.7 Normative Language
Throughout this reference the following terminology is used consistently.
shall
indicates a mandatory language rule.
shall not
indicates prohibited behaviour.
should
indicates a recommendation.
may
indicates implementation-defined or optional behaviour.
Examples are informative and are not themselves part of the language specification.
1.8 Document Organization
The remainder of this reference is organized as follows.
- Chapter 2 describes the lexical structure of the language.
- Chapter 3 describes program structure.
- Chapter 4 defines the type system.
- Subsequent chapters define declarations, expressions, statements, functions, generics, and the standard library.
Appendices provide the complete grammar, keyword list, operator precedence table, and other reference mate
This book is also available as a PDF
