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 :
Instruction | Opération sur la pile | Param | Description | |
Avant | Aprè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 | |
CHKc | No change | PQ | Checks value is between upper and lower bounds | |
CHR | (i) | c | Converts integer to character | |
CSP | Special | Q | Call standard procedure | |
CUP | Special | PQ | Call user procedure | |
DECc | (x) | x | Q | Decrement |
DIF | (s, s) | s | Set difference | |
DVI | (i,i) | i | Integer division | |
DVR | (r,r) | r | Real division | |
ENT | Special | PQ | Enter block | |
EOF | (a) | b | Test on end of file | |
EQUc | (x,x) | b | Q | Compare 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) | b | Q | Compare on greater or equal |
INCc | (x) | x | Q | Increment |
INDc | (a) | x | Q | Indexed fetch |
INN | (i,s) | b | Test set membership | |
INT | (s,s) | s | Set intersection | |
IOR | (b,b) | b | Boolean inciusive OR | |
IXA | (a,i) | a | Q | Compute indexed address |
LAO | a | Q | Load base level address | |
LCA | a | Q | Load address of constant | |
LCI | x | PQ | Load constant indirect - assembler generated | |
LDA | a | PQ | Load address with level P | |
LDCc | x | Q | Load constant | |
LDOc | x | Q | Load contents of base level address | |
LEQc | (x,x) | b | Q | Compare on less than or equal |
LESc | (x,x) | b | Q | Compare on less than |
LODc | x | PQ | Load contents of address | |
MOD | (i,i) | i | Modulo | |
MOV | (a,a) | Q | Move | |
MPI | (i,i) | i | Integer multiplication | |
MPR | (r,r) | r | Real multiplication | |
MST | Special | P | Mark stack | |
NEQc | (x,x) | b | Q | Compare 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 | |
RETc | Special | 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) | Q | Store at base level address | |
STOc | (a,x) | Store at base level address | ||
STP | No effect | Stop | ||
STRc | (x) | PQ | Store at level P | |
TRC | (r) | i | Truncate | |
UJC | No effect | Error in case statement | ||
UJP | No effect | Q | Unconditional jump | |
UNI | (s, s) | s | Set union | |
XJP | (i) | Q | Indexed 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
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
- GPMachine : Télécharger la dernière version
- Compiler Design : R. Wilhelm, et D. Maurer ISDN-10 : 0201422905
References
- IHDCB332 - Théorie des langages : Syntaxe et sémantique : PY Schobbens,
Syntaxe et sémantique
(January 2010) - Prof. Dr. Dr. h.c. mult. Reinhard Wilhelm :
Compiler Design Lab
(version 30/07/10) - 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.