P-Code

Autre jeu d'instructions p-code

Steven Pemberton et Martin Danielsref 3 proposent une implémentation Pascal du P-code comme le montre le tableau suivant :

InstructionOpération sur la pileParamDescription
AvantAprès
ABI(i)i Absolute value of integer
ABR(r)r Absolute value of real
ADI(i,i)i Adds two integers on the top of the stack and leaves an integer result
ADR(r,r)r Adds two reals on the top of the stack and leaves a real result
CHKcNo changePQChecks value is between upper and lower bounds
CHR(i)c Converts integer to character
CSPSpecialQCall standard procedure
CUPSpecialPQCall user procedure
DECc(x)xQDecrement
DIF(s, s)s Set difference
DVI(i,i)i Integer division
DVR(r,r)r Real division
ENTSpecialPQEnter block
EOF(a)b Test on end of file
EQUc(x,x)bQCompare on equal
FJP(b)  False jump
FLO(i,r)r,r Float next to the top
FLT(i)r Float top of the stack
GEQc(x,x)bQCompare on greater or equal
INCc(x)xQIncrement
INDc(a)xQIndexed fetch
INN(i,s)b Test set membership
INT(s,s)s Set intersection
IOR(b,b)b Boolean inciusive OR
IXA(a,i)aQCompute indexed address
LAO aQLoad base level address
LCA aQLoad address of constant
LCI xPQLoad constant indirect - assembler generated
LDA aPQLoad address with level P
LDCc xQLoad constant
LDOc xQLoad contents of base level address
LEQc(x,x)bQCompare on less than or equal
LESc(x,x)bQCompare on less than
LODc xPQLoad contents of address
MOD(i,i)i Modulo
MOV(a,a) QMove
MPI(i,i)i Integer multiplication
MPR(r,r)r Real multiplication
MSTSpecialPMark stack
NEQc(x,x)bQCompare on not equal
NGI(i)i Integer sign inversion
NGR(r)r Real sign inversion
NOT(b)b Boolean not
ODD(i)b Test on odd
ORDc(x)i Convert to integer
RETcSpecial Return from block
SBI(i,i)i Integer subtraction
SBR(r,r)r Real subtraction
SGS(i)s Generate singleton set
SQI(i)i Squareinteger
SQR(r)r Square real
SROc(x) QStore at base level address
STOc(a,x)  Store at base level address
STPNo effect Stop
STRc(x) PQStore at level P
TRC(r)i Truncate
UJCNo effect Error in case statement
UJPNo effectQUnconditional jump
UNI(s, s)s Set union
XJP(i) QIndexed jump

Types à utiliser dans la pile:

a address
b boolean
c character
i integer
r real
s set
x un des types qui précèdent

Contents Haut

Retour à la page sur le p-code.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 31/07/2010, last modified the 21/03/2020
Source of the printed document:https://www.gaudry.be/en/langages-pcode-rf-autres.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

Useful links

Contents Haut

References

  1. book Language of the document:fr IHDCB332 - Théorie des langages : Syntaxe et sémantique : PY Schobbens, Syntaxe et sémantique (January 2010)
  2. View the html document Language of the document:uk Prof. Dr. Dr. h.c. mult. Reinhard Wilhelm : Compiler Design Lab (version 30/07/10)
  3. View the html document Language of the document:uk The P4 Compiler and Interpreter : Steven Pemberton, Martin Daniels, Pascal Implementation (version 30/07/10)

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut