Deutsch English Français Italiano |
<0ff7adc1bf3dcedb11194712f0e33059789c8690.camel@gmail.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: wij <wyniijj5@gmail.com> Newsgroups: comp.lang.c Subject: New computation model and perspective of C/C++ Date: Thu, 20 Feb 2025 03:29:21 +0800 Organization: A noiseless patient Spider Lines: 132 Message-ID: <0ff7adc1bf3dcedb11194712f0e33059789c8690.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Date: Wed, 19 Feb 2025 20:29:23 +0100 (CET) Injection-Info: dont-email.me; posting-host="4cfa1410c56edf6929d1c56bc80b08dd"; logging-data="2535221"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/WEs+0/HumXmv4/8th3ww5" User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) Cancel-Lock: sha1:V1ZXdmYnJITo07oNONQA3HOtjmU= Bytes: 5620 libwy-0.69.6 is released https://sourceforge.net/projects/cscall/ The manpage document (description) for Spu is modifed a bit. ----------------------- Wy.Sct.Spu(3wy) Wy.Sct.Spu(= 3wy) NAME Spu - Class of general purpose Soft-CPU SYNOPSIS Except POD types, C structures, all types are declared in namespace = Wy. #include <CSCall/Sct.h> Spu (Soft CPU) is a revised model of Turing Machine and a class = that acts like a general purpose CPU-based computing machine to provide = se=E2=80=90 mantics for computing language and for remote program communication. The main differences of Spu and general purpose CPU (or TM) is that= Spu has no =C2=B4register=C2=B4 nor =C2=B4flag=C2=B4, Spu has only a tap= e. The tape is initially empty. Every object (referred to as tape variable) in the tape is a= llo=E2=80=90 cated via instruction Alloc and identified by a continuous index num= ber. Tape variable can be any C++ type, including Spu. The instruction of Spu is application definable. Except necessary = few, about >30 instructions are defined for convenience, see man= page Wy.Sct(3wy). Documentation following omits the scope name Wy::Sct for each occurr= ence of Spu for clearity. PUBLIC MEMBERS class Reply typedef ssize_t IndexType Spu() ~Spu() InstrIdx next_instr Array<InstrIdx> istack Array<unsign char> tape PtrArray<InstrBase> program template<T> T& get_data(IndexType) const void set_instr_base() Errno run(InstrIdx) Errno step() void add_instr(InstrBase*) ----[cut] This post is to emphasize the theoretical function and capability of C/C++ language, which is equally important to their practical usage. Many might be surprised what the hell C/C++ has anything to do with the theoretical Turing Machine (altho many discussion/program of C/C++ are/were actually abstract, therefore theoretical) and might think they don't need s= uch a 'trivial' thing. Probably, but likely naive: Turing Machine is the the mode= l of all general purpose computers. ALL things, including C++, are merely differ= ent aspects of TM. The real thing is actually even more, all deterministic form= al logic and mathemathics (if presented in a formal way) are less powerful tha= n TM. C++'s application needs not to be database, html, png...,etc. Ex1: "Object Oriented": Every function call can be viewed as a method of th= e object involved in the tape... (programing style involves the decompos= tion of the problem, important, but not changing the essence) Ex2: "Sequence point": The concept of 'sequence pint' is unnecessary in Spu program. In C/C++, 'sequence point' has to be invented. Even so, it mi= ght still not be the final term. Ex3: if((ch>=3D'a')&&(ch<=3D'z')) { /* ... */ }; In Spu program, the C/C++ expression above would be like: Jb(ch,'a',lab1); // if ch<'a', goto lab1 (exact expression may be a = bit // different) Ja(ch,'z',lab1); // if ch>'z', goto lab1 /* ... */ lab1: ... No need to explain what the logical compound statement really mean ( tradition logic has the similar prboem, just more subtler). Ex4: The Peano axiom: 1. 1=E2=88=88=E2=84=95 2. n=E2=88=88=E2=84=95 -> S(n)=E2=88=88=E2=84=95 A problem of Peano axiom is: Is infinity a natural number? The basic answer is that, formal logic is inadequate for procedual fac= t. Basically, Peano axiom did not solve what the 'natural number' is, it = just goes in circle changing termonology like C++ does (useful, though, if = you do not dig deeper, and no deeper usage as well). Ex5: Multi-tasking in Spu is basically just multiple instances of class Spu= .. Or, you can make tape variables whose type is Spu... Ex6: Traditional TM is a simplest case of Spu. It is no sense to restrict operations to comparing symbols and only moving r/w head left or right= to be orthodoxical. And, the idea of Non-Deterministic TM (an obscure, obstructive now) can be dropped. --------- Beside the theoretical part. Class Spu is also useful as the back-end of al= l interpreting languages (sufificitate ones may be highly optimized). Also because the implement of Spu is short, the range of application is hug= e and foundamental. Clib may consider adding one such thing.