Interpretive rules and instantiation rules

Slides:



Advertisements
Similar presentations
CPSC 388 – Compiler Design and Construction
Advertisements

Project: Processes and Resource Management Textbook: pages Lubomir Bic.
Chapter 8 Scope, Lifetime and More on Functions. Definitions Scope –The region of program code where it is legal to reference (use) an identifier Three.
The Functions and Purposes of Translators Code Generation (Intermediate Code, Optimisation, Final Code), Linkers & Loaders.
School of Computing and Engineering, University of Huddersfield LANGUAGE TRANSLATORS: WEEK 10 LECTURE: symbol tables TUTORIAL: Pen and paper exercises.
Tutorial 6 & 7 Symbol Table
Hello, world! Dissect HelloWorld.java Compile it Run it.
Basic Elements of C++ Chapter 2.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Functions in C. Function Terminology Identifier scope Function declaration, definition, and use Parameters and arguments Parameter order, number, and.
Symbol Table (  ) Contents Map identifiers to the symbol with relevant information about the identifier All information is derived from syntax tree -
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Modelling.
XL as an extension of the L-system formalism Tutorial "Modelling Plants with GroIMP", Cottbus, March 11-12, 2008 Winfried Kurth Ole Kniemeyer Reinhard.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural.
Tutorial „Modelling in the language XL“ University of Göttingen (Germany), September 21/22, 2009 Winfried Kurth Some basic examples in XL (part 1) related.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Basic examples.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
CSC 107 – Programming For Science. Today’s Goal  When lecture over, start understanding pointers  What a pointer is and what it is not  Why pointers.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
CSC 107 – Programming For Science. Today’s Goal  When lecture over, start understanding pointers  What a pointer is and what it is not  Why pointers.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Functions Top-down design Breaking a complex problem into smaller parts that we can understand is a common practice. The process of subdividing a problem.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Introduction to.
Illustration of a Visual Basic Program Running an Ada Program 1 by Richard Conn 11 September 1999.
I Power Higher Computing Software Development Development Languages and Environments.
Modelling above- and below-ground competition together Winfried Kurth University of Göttingen Chair for Computer Graphics and Ecological Informatics wk.
Adding functionality to a growth model; A tutorial on queries in GroImp Basic plant.gsz Adding function using queries.
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Gerhard Buck-Sorlin and Winfried.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 15: Overloading and Templates.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Tutorial „Modelling in the language XL“ University of Göttingen (Germany), September 21/22, 2009 Winfried Kurth Some basic examples in XL (part 2) related.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
XNA Tutorial 1 For CS134 Lecture. Overview Some of the hard work has already been done for you. If you build and run your game now, the GraphicsDeviceManager.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
1 Chapter 8 Scope, Lifetime, and More on Functions CS185/09 - Introduction to Programming Caldwell College.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Chapter Topics The Basics of a C++ Program Data Types
MPEG-4 Binary Information for Scenes (BIFS)
Chapter 6: User-Defined Functions I
Programming Languages
CSCI-235 Micro-Computer Applications
Java Programming Language
Basic Elements of C++.
Chapter 12 Variables and Operators
Objectives Identify the built-in data types in C++
Graph-Based Operational Semantics
Chapter 5 Classes.
Classes.
Data Structures and Algorithms I
Engineering Innovation Center
Basic Elements of C++ Chapter 2.
Value returning Functions
Programming Funamental slides
Thinking about grammars
Pointer to Structures Lesson xx
Compiler design.
Accomplishing Executables
RECURSION Annie Calpe
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Understand the interaction between computer hardware and software
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Thinking about grammars
Bubble Sort begin; int A[10]; main(){ int i,j; Do 10 i = 0, 9, 1
Presentation transcript:

Interpretive rules and instantiation rules Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), 27-28 September, 2010 Winfried Kurth Interpretive rules and instantiation rules related material: XL code files sm09_e??.rgg URL http://www.uni-forst.gwdg.de/~wkurth/ and drive T:\rgg on CIP pool stations

Interpretive rules insertion of a further phase of rule application directly preceding graphical interpretation (without effect on the next generation) application of interpretive rules interpretation by turtle

Example: module MainBud(int x) extends Sphere(3) {{setShader(GREEN);}}; module LBud extends Sphere(2) {{setShader(RED);}}; module LMeris; module AMeris; module Flower; const float d = 30; const float crit_dist = 21; protected void init() [ Axiom ==> MainBud(10); ] public void run() { [ MainBud(x) ==> F(20, 2, 15) if (x > 0) ( RH(180) [ LMeris ] MainBud(x-1) ) else ( AMeris ); LMeris ==> RU(random(50, 70)) F(random(15, 18), 2, 14) LBud; LBud ==> RL(90) [ Flower ]; AMeris ==> Scale(1.5) RL(90) Flower; /* Flower: here only a symbol */ ] applyInterpretation(); /* call of the execution of interpretive rules (to be done in the imperative part { ... } !) */ } protected void interpret() /* block with interpretive rules */ [ Flower ==> RH(30) for ((1:5)) ( RH(72) [ RL(80) F(8, 1, 9) ] );

further example: generates the so-called „Menger sponge“ (a fractal) public void run() { [ Axiom ==> A; A ==> Scale(0.3333) for (int i:(-1:1)) for (int j:(-1:1)) if ((i+1)*(j+1) != 1) ( [ Translate(i, j, 0) A ] ); ] applyInterpretation(); } public void interpret() A ==> Box; generates the so-called „Menger sponge“ (a fractal)

(a) (b) (c) public void run() { [ Axiom ==> A; { [ Axiom ==> A; A ==> Scale(0.3333) for (int i:(-1:1)) for (int j:(-1:1)) if ((i+1)*(j+1) != 1) ( [ Translate(i, j, 0) A ] ); ] applyInterpretation(); } public void interpret() [ A ==> Box; (a) (b) (c) A ==> Box(0.1, 0.5, 0.1) Translate(0.1, 0.25, 0) Sphere(0.2); A ==> Sphere(0.5);

what is generated by this example? public void run() { [ Axiom ==> [ A(0, 0.5) D(0.7) F(60) ] A(0, 6) F(100); A(t, speed) ==> A(t+1, speed); ] applyInterpretation(); } public void interpret() A(t, speed) ==> RU(speed*t);

a very similar type of rules in XL: instantiation rules purpose: replacement of single modules by more complicated structures, only for visual representation (similar as for interpretive rules) but: less data are stored (less usage of memory) in contrast to interpretive rules, no turtle commands with effect on other nodes can be used further, arising possibility: „replicator nodes“ for copying and relocation of whole structures

instantiation rules: syntax no new sort of rule arrow specification of the instantiation rule directly in the declaration of the module which is to be replaced module A ==> B C D; replaces (instantializes) everywhere A by B C D

example sm09_e43.rgg const int multiply = EDGE_0; /* user-defined edge type */ module Tree ==> F(20, 1) [ M(-8) RU(45) F(6, 0.8) Sphere(1) ] [ M(-5) RU(-45) F(4, 0.6) Sphere(1) ] Sphere(2); module Replicator ==> [ getFirst(multiply) ] Translate(10, 0, 0) [ getFirst(multiply) ]; public void run1() [ Axiom ==> F(2, 6) P(10) Tree; ] public void run2() Axiom ==> F(2, 6) P(10) Replicator -multiply-> Tree; Tree is instantiated with the red structure inserts all what comes after the „multiply“ edge