Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Assembly language

by jcb (Parson)
on Dec 16, 2019 at 01:54 UTC ( [id://11110207]=note: print w/replies, xml ) Need Help??


in reply to Assembly language

The Perl 5 interpreter has its own special quasi-assembly language implemented using C macros. If you are interested in this dialect of assembly, which is useful for writing complex XSUB modules, you should read the documentation for perlxs, perlxstut, perlapi, perlguts, and perlembed as a start.

Replies are listed 'Best First'.
Re^2: Assembly language
by LanX (Saint) on Dec 16, 2019 at 02:31 UTC
    I'd rather the op-code the machine code of an theoretical "Perl CPU"

    The C-macros are more alike ASM macros helping abstracting away complicated concepts, like variable types.

    The whole comparison is quite wobbly because Perl is many abstraction layers away from machine code.

    • Machine code
    • Assembler
    • Macro Assembler
    • C
    • Perl
    But also technologies like
    • memory management
    • dynamic typing
    • garbage collection
    • lexical scoping
    • contextual syntax
    • ...

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      While the implementation sits several layers up the stack from the actual hardware, perl is a VM implementing a specialized processor optimized for running Perl code. I vaguely recall a quip somewhere in the XS documentation along the lines of "Real Programmers can write assembly in any language" referring to the macros used in XS code.

      It is hilariously far into the CISC category, but there is a CPU architecture in there. Think of perl itself as microcode...

        I've heard many times that the op tree is only almost an AST and the run time engine is only almost a VM.

        One says that's because a lot of external stuff was hooked into it and some state conditions are not intrinsic.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11110207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-18 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found