CB Programming Language
What's Happening Now
- Adjusting the language to fit requirements and clarify the design.
- Working on a syntax rules definition and a preliminary first phase (the "tokenizer") of a compiler.
- Looking at a development pllatform.
Why am I creating a new programming language?
I was a compiler developer, working on and managing implemention of several compilers. I published a paper on local optimization ("Local Optimizations"), managed a compiler development group,
and I participated in the ANSI standardization of Fortran 77. My specialty was machine code generation and optimization in compilers.
I've been retired now, and I am no longer working in compiler language development.
I have been keeping up with ideas in programming languages ever since I began in this field back in the early 1960s.
I learned and worked with a succession of my own languages, each trying to "fix" some issue in programming.
Languages have come and gone in popularity because new ideas happened.
I have used extensively Fortran, C, PHP, the latest version 7, with OOP features.
I have created several "play" languages. One, in 2003, was "CodeBol".
I am seriously working on definition and implementation of CB, an object-oriented programming language.
Goals in the design of CB:
- Object oriented, with single inheritance and multiple interface implementation.
- CB is a pure object-oriented language. All values are objects. Strings, variables, constants, expressions and arrays all look like objects.
- Parameterized procedures in objects. They apply to multiple types, but use the same logic.
- Reduced punctuation and fewer words. Concise syntax.
- Symmetry. Enhance readability and ease of editing.
- Remove definition of parts of the language from the compiler and define them in source.
- Support read-only and write-only properties.
- Definition of expression operators and type casts and array storage and indexing.
- Support matrix arithmetic
- No typeless or "mixed" type variables or arrays.
- Type safety. It is possible to keep inches separate from centimeters.
- Avoid problems in the use of an ENUM feature as defined in C.
- No explicit memory allocation/deallocation or pointer manipulation.
- Avoid the mistakes caused by assuming an arithmetic value is a Boolean (true/false).
- String output formatting better controlled, not in the style of Fortran.
- Capable of compilation to efficient machine code for multiple processor types.
- Check more at compile time.
- No built-in support for events and threads.
Features
- An array can have string indexes rather than integer indexes. Variable length arrays are supported. Arrays of arrays are possible.
- A number of array procedures and statements are provided. Array expressions and assignments.
- A structure can be defined to make a list or tree or other structure which operates like an array. Also stacks, etc.
- Arrays and string type and matrix items are defined with structures.
- Two dimensional matrices defined.
- Support for matrix expressions includes add, subtract, and matrix multiply.
- Pointers are not used. Explicit memory allocation and deallocation is not provided.
- Some operators are different. Equality is "=?" rather than "==". This helps avoid some errors.
- Assignment operators do not produce a result, again to avoid errors.
- Operators and type casts can be defined on objects.
- A function invocation with no arguments does not use a pair of parentheses.
- A method invocation does not use a pair of parentheses.
- A generator function enables abstraction when obtaining a sequence of values, also simpler scan of arrays or strings or lists.
- CB has a parameterized procedure type capability. One object definition can support multiple types using the same logic.
- An enhanced object type can keep units apart, like Fahrenheit versus Celsius, or Centimeters versus Inches.
- The model for file manipulation is different. Files are typed to keep text separate from data blocks.
- Formatting for output is designed to be less error-prone, and is not patterned after Fortran.
- I/O is not in the basic language, but in a library.
- A property feature helps with information hiding and protection.
- The confusing ternary operator of C/C++ is replaced with an inline if-then-else in expressions.
- Bit fields in an integer can be defined and used, a feature needed for writing compilers.
- Complex type is a defined object, allowing easy modifications.
The "Hello, World!" program, invoked by its constructor @Main:
{ object @Main
{ new # this is the constructor
@ "Hello, World!"
}
}
To comment:
E-mail me at: john (at) IdahoBagwells (dot) NET.