Exemple de p-code LSD010
Code LSD010 analysé
Code c (P2_4.t) (13 lignes)
integer foo() { { integer a; } a = 7; return(a); } void main() { { } write(foo()); }
Affichage console de l'analyse
;
;
; LSD010 Compiler [SSHD09]
;
;
;****************************************************************************************
; Creating Symbols Table
; Using Test file...true
; Parsing tests/P2_4.t file...
; Calling yyparse()
; End of yyparse execution;
;
; Warning : 'Print tree not requested (use DEB_I level minimum to print it)' On lsd10.y, Line 647
; -------------------------------------------------------------
;
; Warning : 'Print Symbols table not requested (use DEB_I level minimum to print it)' On lsd10.y, Line 618
; -------------------------------------------------------------
;
; 1st AST walk: filling symbols table...
; 2nd AST walk: checking types and constraints...
; Generating AST Graph from last compilation into astLSD10.dot file ... (graphVizHelper.c, col 202)
; ...OK Graph printed
; Generating image from dot file : dot -Tjpg -olsd10_Img201062034437.jpg astLSD10.dot
; Generating p-code...
;
; Open lsd10.pm p-code file...OK
; Start program
ssp 0
mst 0
cup 0 @fct_main_0
ujp @program_end
; Start of foo function
define @fct_foo_0
ssp 6
ujp @fct_body_foo_0
define @fct_body_foo_0
lda i 0 0
; ---Start affectation
; Generate address for a variable
lda i 0 5
; ---Generate value for 7 integer constant
ldc i 7
sto i
; End of affectation
; ---a id
; Generate address for a variable
lda i 0 5
ind i
; Return
sto i
retf
retf
; End of foo function
; Start of main function
define @fct_main_0
ssp 5
ujp @fct_body_main_0
define @fct_body_main_0
lda i 0 0
; ---Start write operation
; ---foo function call
mst 0
cup 0 @fct_foo_0
prin
; ---End of write operation
retf
; End of main function
define @program_end
stp
; End of program
;
; ...OK P-code generated;
; Cleaning memory...
; ...OK Memory cleaned
;
;
; Parsing started at Sun Jun 20 03:44:38 2010
; 13 lines 91 chars parsed in 0.1 seconds
; Verbose set on "Minimum excution messages" level
; That's All Folks!
OK
steph@astate:/mnt/steph_docs/FUNDP/lsd010$
AST [“Abstract Syntaxic Tree”2] généré
P-code LSD010
Code P-code (lsd10.pm) (44 lignes)
; Start program ssp 0 mst 0 cup 0 @fct_main_0 ujp @program_end ; Start of foo function define @fct_foo_0 ssp 6 ujp @fct_body_foo_0 define @fct_body_foo_0 ; ---Start affectation ; Generate address for a variable ; ---Generate value for 7 integer constant ldc i 7 ; End of affectation ; ---a id ; Generate address for a variable ind i ; Return ; End of foo function ; Start of main function define @fct_main_0 ssp 5 ujp @fct_body_main_0 define @fct_body_main_0 ; ---Start write operation ; ---foo function call mst 0 cup 0 @fct_foo_0 ; ---End of write operation ; End of main function define @program_end ; End of program
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 28/10/2018
Source of the printed document:https://www.gaudry.be/en/langages-pcode-lsd.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.
- ↑a,b,c LSD010 : Langage Simple et Didactique Il existe une un certain nombre d'interprétations de l'acronyme LSD (Langage Symbolique Didactique, Langage Sans Difficulté, Langage Simple et Didactique). LSD010 est la version 2010 de la suite LSD80, LSD_02, LSD03, LSD04, LSD05, LSD06, LSD07, LSD08, et LSD09.
References
- IHDCB332 - Théorie des langages : Syntaxe et sémantique : PY Schobbens,
Syntaxe et sémantique
(January 2010)
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.