06/03/2007 The TXL Programming Language (4) 1 Mariano Ceccato ITC-Irst Istituto per la ricerca Scientifica e Tecnologica

Slides:



Advertisements
Similar presentations
Introductory to database handling Endre Sebestyén.
Advertisements

1 The TXL Programming Language (3) Mariano Ceccato FBK Fondazione Bruno Kessler
1 Mariano Ceccato FBK Fondazione Bruno Kessler The TXL Programming Language (2)
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
Printf transformation in TXL Mariano Ceccato ITC-Irst Istituto per la ricerca Scientifica e Tecnologica
1 If we modify the machine for the language from F12 p. 47 we can easily construct a machine for the language Observation Turing machine for the language.
SECTION 21.5 Eilbroun Benjamin CS 257 – Dr. TY Lin INFORMATION INTEGRATION.
CSE 425: Semantics II Implementing Scopes A symbol table is in essence a dictionary –I.e., every name appears in it, with the info known about it –Usually.
+ Fractions: Addition & Subtraction Algebra Seminar
1.2 Row Reduction and Echelon Forms
Linear Equations in Linear Algebra
Advanced Package Concepts. 2 home back first prev next last What Will I Learn? Write packages that use the overloading feature Write packages that use.
MINI ERLANG ID1218 Lecture Christian Schulte Software and Computer Systems School of Information and Communication Technology.
Tutorial 6 & 7 Symbol Table
The TXL Programming Language Filippo Ricca ITC-Irst Istituto per la ricerca Scientifica e Tecnologica
EGR 106 – Week 8 Data Files & Functions Interacting with Data Files Functions – Concept – Examples and applications Textbook chapter ,
The TXL Programming Language Mariano Ceccato ITC-Irst Istituto per la ricerca Scientifica e Tecnologica
FALL 2004CENG 351 File Structures1 Indexing Reference: Sections
List Comprehensions. Python’s higher-order functions  Python supports higher-order functions that operate on lists similar to Scheme’s >>> def square(x):
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Attribute Data in GIS Data in GIS are stored as features AND tabular info Tabular information can be associated with features OR Tabular data may NOT be.
CLEF – Cross Language Evaluation Forum Question Answering at CLEF 2003 ( Bridging Languages for Question Answering: DIOGENE at CLEF-2003.
C++ Code Analysis: an Open Architecture for the Verification of Coding Rules Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica
Unix Talk #2 (sed). 2 You have learned…  Regular expressions, grep, & egrep  grep & egrep are tools used to search for text in a file  AWK -- powerful.
1 Chapter 5 LL (1) Grammars and Parsers. 2 Naming of parsing techniques The way to parse token sequence L: Leftmost R: Righmost Top-down  LL Bottom-up.
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
Functional Programming Universitatea Politehnica Bucuresti Adina Magda Florea
Copyright OpenHelix. No use or reproduction without express written consent1.
Unit 2 Healthy eating Speaking &writing. Rules for the class discussion: 1. Only one question/statement allowed for each student. 2. Students should speak.
Supported by ELTE IKKK, Ericsson Hungary, in cooperation with University of Kent Erlang refactoring with relational database Anikó Víg and Tamás Nagy Supervisors:
Exponents. Review: Evaluate each expression: 1.3 ³ 2.7¹ 3.-6² 4.(⅜)³ 5.(-6)² 6.3· 2³ Answers /
Today we will solve equations with two variables. Solve = figure out.
Unit 18 Advanced Database Design
We are learning to write expressions using variables. (8-1)
Smart customizations Microsoft Dynamics TM AX 4.0 Michael Fruergaard Pontoppidan Partner Productivity – Microsoft Dynamics AX TM Microsoft Corporation.
Scalable Clone Detection and Elimination for Erlang Programs Huiqing Li, Simon Thompson University of Kent Canterbury, UK.
Solving an equation with one unknown From arithmetic to algebra Modifying equations in algebra.
NSF DUE ; Wen M. Andrews J. Sargeant Reynolds Community College Richmond, Virginia.
 We combine like terms in order to simplify expressions. Vocabulary: 1. Terms = sets of numbers and/or variables separated by addition and subtraction.
Algebra: a language of symbols including variables Variable: a symbol, usually a letter, used to represent a number.
Methods Awesomeness!!!. Methods Methods give a name to a section of code Methods give a name to a section of code Methods have a number of important uses.
Working With Database Library And Helpers. Connecting to your Database First you need to set parameters in you database.php file residing in config folder.
Chapter 1 C++ Basics Review (Section 1.4). Classes Defines the organization of a data user-defined type. Members can be  Data  Functions/Methods Information.
CSE 425: Functional Programming I Programs as Functions Some programs act like mathematical functions –Associate a set of input values from the function’s.
SEQUENCES. Introduction The symbols and words of Sequences n is a symbol used all the time in sequences n simply represents a counting number.
March 1, 2009 Dr. Muhammed Al-Mulhem 1 ICS 482 Natural Language Processing SLR Parsing Muhammed Al-Mulhem March 1, 2009.
The TXL Programming Language Filippo Ricca ITC-Irst Istituto per la ricerca Scientifica e Tecnologica
Exponents. Review: Evaluate each expression: 1.3 ³ 2.7¹ 3.-6² 4.(⅜)³ 5.(-6)² 6.3· 2³ Answers /
The TXL Programming Language Filippo Ricca & Mariano Ceccato ITC-Irst Istituto per la ricerca Scientifica e Tecnologica
DATA TODAY L. Grewe. Whole range of solutions This class  Focus on learning Mid-end Traditional Data Systems = Relational Database Systems  Note: if.
Multiplying with exponents
Sourcing Event Tool Kit Multiline Sourcing, Market Baskets and Bundles
Introduction to Parsing (adapted from CS 164 at Berkeley)
Multiplication table. x
Dr. Clincy Professor of CS
B.02 Combining Like Terms.
1.6 Represent Functions as Rules and Tables
C Graphing Functions.
Unix Talk #2 (sed).
FUNCTION NOTATION AND EVALUATING FUNCTIONS
Streams, Delayed Evaluation and a Normal Order Interpreter
Flowcharts and Pseudo Code
Functions and Tables.
POD #30 1/31/19 Write the rule for the following tables:
Hash Maps Introduction
Recursive Procedures and Scopes
Adding and subtracting binomial
CSE341: Programming Languages Lecture 15 Macros
Evaluating an expression with two variable
Lesson 3.3 Writing functions.
Presentation transcript:

06/03/2007 The TXL Programming Language (4) 1 Mariano Ceccato ITC-Irst Istituto per la ricerca Scientifica e Tecnologica

06/03/2007 The TXL Programming Language (4)2 Working with Global Variables  Global variables are a rich and powerful feature that can be used for many distinct purposes, including: - global tables. - multiple results from a rule. - “deep” parameters. - “message-passing” communication between rules in a rule set (e.g, avoiding interference).

06/03/2007 The TXL Programming Language (4)3 Setting Global Table  Global tables can be set up using an export clause before the replace clause in the main rule of a program. Example: function main export Table [repeat table_entry] “Veggie” -> “Cabbage” “Fruit” -> “Apple” “Fruit” -> “Orange” replace [program] P [program] by P [R1] end function define table_entry [stringlit] -> [stringlit] end define

06/03/2007 The TXL Programming Language (4)4 Adding Table Entry  Global tables can be modified by exporting a new binding for the table based on the imported original binding. function addTableEntry import Table [repeat table_entry] … construct newEntry [table_entry] “Veggie” -> “XXX” export Table Table [. newEntry] … end function Example:

06/03/2007 The TXL Programming Language (4)5 Searching in a Table  Global tables can be easily queried using searching deconstructors. Example: deconstruct * [table_entry] Table Kind [stringlit] -> “Orange”  The binding for “Kind” will be the [stringlit] “Fruit”. If no match were to be found, then the deconstructor would fail.

06/03/2007 The TXL Programming Language (4)6 Avoiding interference between rules function shiftByOne export Flag [id] ‘not_found replace [number] N [number] by N [replaceOneByTwo] [replaceTwoByThree] end function function replaceOneByTwo replace [number] 1 export Flag ‘found by 2 end function function replaceTwoByThree import Flag [id] deconstruct Flag ‘not_found replace [number] 2 by 3 end function 1 ---> 2 ---> > 3 We want:

06/03/2007 The TXL Programming Language (4)7 Remarks  Transformation of a list of contiguos if-statements in a case-statement. 1) The rule “transformTwoCases” is necessary. 2) It is not possible create a sequence [repeat T] in this way: - L elem with L [repeat T] and elem [T] - L L’ with L [repeat T] and L’ [repeat T] The Built-in function L [. elem] (or L [. L’]) can be used. If x>1 then … If x<1 then … case … endCase

06/03/2007 The TXL Programming Language (4)8 Exercises Adding to the Expr-language the construct ‘let’. Extending the Calculator.txl at the ‘Let-Expr-language’. - without global-variables (similar to pag. 19 slides 2) - using global-variables let begin x = 1; y = 2; end x+y+1. The output of Calculator.txl on the example will be 4. [number]

06/03/2007 The TXL Programming Language (4)9 Homework Extending the right part of the ‘let-declarations’ ([expression] instead of [number]). Extending the Calculator.txl at the ‘New-Let-Expr-language’. - without global-variables - using global-variables let begin x = 2; y = 1+x; x = 3 end x+y. The output of Calculator.txl on the example will be 6.