P-- or when less is more
Dreaming under the August Sun
-
Defining a simpler scripting language, basically PHP 5.0 but without
type-hints. -
Developing an interpreter for the scripting language above. Basically,
a trimmed-down version of the current interpreter. This is the
"Interpreter project". -
Developing an official static analyzer implemented using the same
scripting language above. People interested into strictness, safety and
security, could contribute with only the knowledge of the P-- language;
no C skills required. This is the "Analyzer project". -
Developing an official compiler, capable to translate the validable
source code into directly executable code, or pseudo-code or whatever,
so to get faster and more efficient programs suitable for serious
applications. A compiler could be realized starting from the analyzer
above and could be based on the P-- language itself, so again no C skills
required. This is the "Compiler project".
The three projects in more detail
Interpreter project
- Formally defined syntax.
- All case-sensitive scanner, with keywords and simpler syntax.
- No type-hints (99% of the users do not care|hate them).
- No type-juggling (99% of the users will finally have to learn types
do really exist and for several good reasons). - A true Object base class implementing hashing and equality comparison.
- Generic (or template) classes like "class Array<K,E> { ... }". The
scripting shall language ignore this syntax; only the analyzer will take
care of it. - Single-quotes '\x00\x01' creates instance of a Bytes object; all the
low-level bytes-related functions go in this class. - Double-quotes "Abcd" create instance of a String object; and yes,
strings are immutable sequences of Unicode codepoints; all the
character-related functions go in this class. - Arrays are regular objects with syntax sugar.
- No php.ini.
- No errors, only exceptions. Any function either do what it is expected
to do, or it fails with exception. - No locale-aware behavior.
Expected audience interested or involved in this project: 99%.
Analyzer project
The analyzer will parse the source (including generic classes),
DocBlocks and annotations, checks for syntax errors, trying to figure
out how data and their types will flow through the code at run time. A
source either validates successfully or do not validate at all. If
it validates successfully, chances are that the program is (at least
formally) correct, safe and secure, and this make people like me very
satisfied and confident. The analyzer could be implemented using the
P-- scripting language itself, no C skills required. My PHPLint project
could be an example of such an implementation.
Expected audience interested or involved in this project: 1%.
Compiler project
Based on the analyzer above, this program may generate fast, efficient
executable code or pseudo-code. In perspective, the interpreter,
the analyzer and the compiler could be implemented starting from
the P-- language itself, an all may take advantage of the improved
performances. Again, no C skills required.
Expected audience interested or involved in this project: 0.1%.
Continuing dreaming...
/|\ Umberto Salsi
/_/ www.icosaedro.it