Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106634 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55260 invoked from network); 16 Aug 2019 17:19:51 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 16 Aug 2019 17:19:51 -0000 To: internals@lists.php.net User-Agent: www.icosaedro.it/tt Date: Fri, 16 Aug 2019 16:48:36 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Posted-By: 87.1.53.9 Subject: P-- or when less is more From: salsi@icosaedro.it (Umberto Salsi) Message-ID: P-- or when less is more Dreaming under the August Sun =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D 1. Defining a simpler scripting language, basically PHP 5.0 but without type-hints. 2. Developing an interpreter for the scripting language above. Basically, a trimmed-down version of the current interpreter. This is the "Interpreter project". 3. 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". 4. 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D 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 { ... }". 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