New computation model and perspective of C/C++

Liste des GroupesRevenir à cl c 
Sujet : New computation model and perspective of C/C++
De : wyniijj5 (at) *nospam* gmail.com (wij)
Groupes : comp.lang.c
Date : 19. Feb 2025, 20:29:21
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <0ff7adc1bf3dcedb11194712f0e33059789c8690.camel@gmail.com>
User-Agent : Evolution 3.54.3 (3.54.3-1.fc41)
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‐
       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 ´register´ nor ´flag´, Spu has only a tape. The tape is initially
       empty. Every object (referred to as tape variable) in the tape is  allo‐
       cated via instruction Alloc and identified by a continuous index number.
       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   manpage
       Wy.Sct(3wy).

       Documentation following omits the scope name Wy::Sct for each occurrence
       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 such a
'trivial' thing. Probably, but likely naive: Turing Machine is the the model of
all general purpose computers. ALL things, including C++, are merely different
aspects of TM. The real thing is actually even more, all deterministic formal
logic and mathemathics (if presented in a formal way) are less powerful than 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 the
     object involved in the tape... (programing style involves the decompostion
     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 might
     still not be the final term.

Ex3: if((ch>='a')&&(ch<='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∈ℕ
     2. n∈ℕ -> S(n)∈ℕ

     A problem of Peano axiom is: Is infinity a natural number?
     The basic answer is that, formal logic is inadequate for procedual fact.
     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 all
interpreting languages (sufificitate ones may be highly optimized).

Also because the implement of Spu is short, the range of application is huge and
foundamental. Clib may consider adding one such thing.



Date Sujet#  Auteur
19 Feb 25 o New computation model and perspective of C/C++1wij

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal