H (Hybrid) Language - v0.03, by Dr. Herong Yang
H (Hybrid) Language
http://www.herongyang.com/H
Copyright © 2021 Dr. Herong Yang. All rights reserved.
This book is a collection of notes on developing a new programming language called H (Hybrid). Topics include: Source code syntax; Data types; Variables, expressions and statements; Classes and objects; Inheritance and encapsulation. Updated in 2021 (Version v0.03) with minor changes.
Table of Contents
H Language License: Open Source and Free
Help Needed to Design H Language
Source Code Encoding Format - UTF-8
Statements End with Semicolons
Block Comments Enclosed in #(...)#
Group Statement Uses (...); Format
Block Statement Uses {...}; Format
All Data Are Structured Objects
All Data Are Created from Classes
Data Literals Are Alias of Object Constructions
Commonly Used Data Types Are Built-in Data Types
All Data Types Are Extensions of "object"
Operations Are Aliases of Function Calls
Evaluation Order of Multiple Operators
Conditional "elseif" Statement
"switch" Statement - Not Supported
"do...while" Statement - Not Supported
Constructor Function: boolean()
Constructor Function: integer()
"integer" "addition" Operation
"integer" "subtraction" Operation
"integer" "multiplication" Operation
"integer" "division" Operation
"integer" "exponentiation" Operation
"integer" "negation" Operation
"integer" "absolute" Operation
"integer" "greater-than" Operation
"integer" "less-than" Operation
"integer" "equal-to" Operation
"integer" "not-equal-to" Operation
"integer" "greater-than-or-equal-to" Operation
"integer" "less-than-or-equal-to" Operation
Escape Sequences in "string" Literals
Escape Sequences for Non-Printable ASCII Characters
Escape Sequences for Unicode Characters
String Literals with Line Breaks
String Literals Continuing on Next Lines
Expression Interpolation in String Literals
String Literals with No Escape Sequences
Constructor Function: string()
string.get() - Retrieve Character from String
x[i] - Array Element Format for string.get()
string.set() - Update Character to String
x[i] - Array Element Format for string.set()
"string" "subtraction" Operation
"string" "multiplication" Operation
"real" "subtraction" Operation
"real" "multiplication" Operation
"real" "exponentiation" Operation
"real" "greater-than" Operation
"real" "not-equal-to" Operation
"real" "greater-than-or-equal-to" Operation
"real" "less-than-or-equal-to" Operation
array.get() - Retrieve Element from Array
x[i] - Array Element Format for array.get()
array.set() - Update Element of Array
x[i] - Array Element Format for array.set()
array.subArray() - Sub-Array Function
Load Program Package Multiple Times
Load Program Package in Functions
$class Statement - Create New Classes
Execution of $class Definition Body
__new() - Object Constructor Function
$instance Statement - Define Instance Template
Execution of $instance Definition Body
$method Statement - Define Object Method
_first() Method - Object Initialization
Access Class Variables from Object Methods
__delete() - Object Destructor Method
$delete Statement - Delete Objects
_last() Method - Object Cleanup
What Is Object-Oriented Programming
Objects Are Created from Classes
Literal Is Special Form of Object Creation
Dot (.) Expression to Access Object Members
Update Object with Object Methods
Inheritance - Object Attachments
$append Statement - Attach Objects
Name Collision in Attached Objects
Append Multiple Object Attachments
$trim Statement - Detach Objects
Build Subclasses with Superclasses
Object Morphinism by Changing Attachments
Encapsulation - Private Members
$public Modifier on Class Members
$private Modifier on Class Members
$public Modifier on Instance Members
$private Modifier on Instance Members
Keywords: H, Programming, Language