Lecture 12: Semantic Analysis. Semantic Analysis

Similar documents
Syntax Parsing 1. Grammars and parsing 2. Top-down and bottom-up parsing 3. Chart parsers 4. Bottom-up chart parsing 5. The Earley Algorithm

Parsing of part-of-speech tagged Assamese Texts

COMPUTATIONAL COMPLEXITY OF LEFT-ASSOCIATIVE GRAMMAR

A R "! I,,, !~ii ii! A ow ' r.-ii ' i ' JA' V5, 9. MiN, ;

Some Principles of Automated Natural Language Information Extraction

CS 598 Natural Language Processing

Basic Parsing with Context-Free Grammars. Some slides adapted from Julia Hirschberg and Dan Jurafsky 1

Proof Theory for Syntacticians

Natural Language Processing. George Konidaris

11/29/2010. Statistical Parsing. Statistical Parsing. Simple PCFG for ATIS English. Syntactic Disambiguation

RANKING AND UNRANKING LEFT SZILARD LANGUAGES. Erkki Mäkinen DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF TAMPERE REPORT A ER E P S I M S

Compositional Semantics

Chapter 4: Valence & Agreement CSLI Publications

PH.D. IN COMPUTER SCIENCE PROGRAM (POST M.S.)

Language properties and Grammar of Parallel and Series Parallel Languages

ACADEMIC AFFAIRS GUIDELINES

Specifying Logic Programs in Controlled Natural Language

Context Free Grammars. Many slides from Michael Collins

A relational approach to translation

Specification and Evaluation of Machine Translation Toy Systems - Criteria for laboratory assignments

Chinese Language Parsing with Maximum-Entropy-Inspired Parser

South Carolina English Language Arts

An Interactive Intelligent Language Tutor Over The Internet

Type Theory and Universal Grammar

Abstractions and the Brain

Grammars & Parsing, Part 1:

UNIVERSITY OF OSLO Department of Informatics. Dialog Act Recognition using Dependency Features. Master s thesis. Sindre Wetjen

School of Innovative Technologies and Engineering

THE ROLE OF DECISION TREES IN NATURAL LANGUAGE PROCESSING

AQUA: An Ontology-Driven Question Answering System

Objectives. Chapter 2: The Representation of Knowledge. Expert Systems: Principles and Programming, Fourth Edition

Focused on Understanding and Fluency

Accurate Unlexicalized Parsing for Modern Hebrew

LTAG-spinal and the Treebank

DESIGNPRINCIPLES RUBRIC 3.0

Analysis of Probabilistic Parsing in NLP

Linguistics. Undergraduate. Departmental Honors. Graduate. Faculty. Linguistics 1

Update on Standards and Educator Evaluation

Evolution of Collective Commitment during Teamwork

"f TOPIC =T COMP COMP... OBJ

Outline. Web as Corpus. Using Web Data for Linguistic Purposes. Ines Rehbein. NCLT, Dublin City University. nclt

Ensemble Technique Utilization for Indonesian Dependency Parser

Developing a TT-MCTAG for German with an RCG-based Parser

South Carolina College- and Career-Ready Standards for Mathematics. Standards Unpacking Documents Grade 5

Spoken Language Parsing Using Phrase-Level Grammars and Trainable Classifiers

Page 1 of 11. Curriculum Map: Grade 4 Math Course: Math 4 Sub-topic: General. Grade(s): None specified

Semi-supervised methods of text processing, and an application to medical concept extraction. Yacine Jernite Text-as-Data series September 17.

Character Stream Parsing of Mixed-lingual Text

Efficient Normal-Form Parsing for Combinatory Categorial Grammar

GACE Computer Science Assessment Test at a Glance

Enhancing Unlexicalized Parsing Performance using a Wide Coverage Lexicon, Fuzzy Tag-set Mapping, and EM-HMM-based Lexical Probabilities

Statewide Framework Document for:

A Version Space Approach to Learning Context-free Grammars

Spring 2016 Stony Brook University Instructor: Dr. Paul Fodor

Lecture 10: Reinforcement Learning

Radius STEM Readiness TM

cambridge occasional papers in linguistics Volume 8, Article 3: 41 55, 2015 ISSN

TEACHING AND EXAMINATION REGULATIONS PART B: programme-specific section MASTER S PROGRAMME IN LOGIC

Pre-Processing MRSes

Linking Task: Identifying authors and book titles in verbose queries

Learning Computational Grammars

Machine Learning from Garden Path Sentences: The Application of Computational Linguistics

Montana Content Standards for Mathematics Grade 3. Montana Content Standards for Mathematical Practices and Mathematics Content Adopted November 2011

Refining the Design of a Contracting Finite-State Dependency Parser

A General Class of Noncontext Free Grammars Generating Context Free Languages

The Smart/Empire TIPSTER IR System

The Strong Minimalist Thesis and Bounded Optimality

Using dialogue context to improve parsing performance in dialogue systems

Target Language Preposition Selection an Experiment with Transformation-Based Learning and Aligned Bilingual Data

MASTER OF SCIENCE (M.S.) MAJOR IN COMPUTER SCIENCE

ABSTRACT. A major goal of human genetics is the discovery and validation of genetic polymorphisms

Backwards Numbers: A Study of Place Value. Catherine Perez

BANGLA TO ENGLISH TEXT CONVERSION USING OPENNLP TOOLS

Degree Qualification Profiles Intellectual Skills

MTH 141 Calculus 1 Syllabus Spring 2017

The presence of interpretable but ungrammatical sentences corresponds to mismatches between interpretive and productive parsing.

Remainder Rules. 3. Ask students: How many carnations can you order and what size bunches do you make to take five carnations home?

Aspectual Classes of Verb Phrases

ReinForest: Multi-Domain Dialogue Management Using Hierarchical Policies and Knowledge Ontology

Lecture 2: Quantifiers and Approximation

Software Maintenance

English Language and Applied Linguistics. Module Descriptions 2017/18

This Performance Standards include four major components. They are

The Discourse Anaphoric Properties of Connectives

Experiments with SMS Translation and Stochastic Gradient Descent in Spanish Text Author Profiling

Adapting Stochastic Output for Rule-Based Semantics

Highlighting and Annotation Tips Foundation Lesson

LQVSumm: A Corpus of Linguistic Quality Violations in Multi-Document Summarization

Towards a Machine-Learning Architecture for Lexical Functional Grammar Parsing. Grzegorz Chrupa la

Focus of the Unit: Much of this unit focuses on extending previous skills of multiplication and division to multi-digit whole numbers.

GRAMMAR IN CONTEXT 2 PDF

Conversation Starters: Using Spatial Context to Initiate Dialogue in First Person Perspective Games

NATURAL LANGUAGE PARSING AND REPRESENTATION IN XML EUGENIO JAROSIEWICZ

ENGBG1 ENGBL1 Campus Linguistics. Meeting 2. Chapter 7 (Morphology) and chapter 9 (Syntax) Pia Sundqvist

Learning Methods in Multilingual Speech Recognition

Prediction of Maximal Projection for Semantic Role Labeling

Holy Family Catholic Primary School SPELLING POLICY

Presentation skills. Bojan Jovanoski, project assistant. University Skopje Business Start-up Centre

The Algebra in the Arithmetic Finding analogous tasks and structures in arithmetic that can be used throughout algebra

PRODUCT PLATFORM DESIGN: A GRAPH GRAMMAR APPROACH

Transcription:

The University of North Carolina at Chapel Hill Spring 2002 Lecture 12: Semantic Analysis Feb 6 1 Semantic Analysis From Code Form To Program Meaning Source Code Compiler or Interpreter Translation Execution Interpre- tation Target Code 2 1

Phases of Compilation 3 Specification of Programming Languages PLs require precise definitions (i.e. no ambiguity) Language form (Syntax) Language meaning (Semantics) Consequently, PLs are specified using formal notation: Formal syntax» Tokens» Grammar Formal semantics» Attribute Grammars» Dynamic Semantics 4 2

Attribute Grammars Context-Free Grammars (CFGs( CFGs) ) are used to specify the syntax of programming languages E.g. arithmetic expressions How do we tie these rules to mathematical concepts? Attribute grammars are annotated CFGs in which annotations are used to establish meaning relationships among symbols Annotations are also known as decorations 5 Attribute Grammars Each grammar symbols has a set of attributes E.g. the value of E 1 is the attribute E 1.val Each grammar rule has a set of rules over the symbol attributes Copy rules Semantic Function rules» E.g. sum, quotient 6 3

Context-free grammars are not tied to an specific parsing order E.g. Recursive descent, LR parsing Attribute grammars are not tied to an specific evaluation order This evaluation is known as the annotation or decoration of the parse tree 7 The figure shows the result of annotating the parse tree for (1+3)*2 Each symbols has at most one attribute shown in the corresponding box Numerical value in this example Operator symbols have no value Arrows represent attribute flow 8 4

9 Synthetic and Inherited Attributes In the previous example, semantic information is pass up the parse tree We call this type of attributes are called synthetic attributes Attribute grammar with synthetic attributes only are said to be S-attributed Semantic information can also be passed down the parse tree Using inherited attributes Attribute grammar with inherited attributes only are said to be non-s-attributed 10 5

Inherited Attributes Semantic information can also be passed down the parse tree Using inherited attributes Attribute grammar with inherited attributes only are said to be non-s-attributed Top-down grammars generally require non-s- attributed flows The previous annotated grammar was an S-attributed S LR(1) 11 Non-S-Attributed Grammars 12 6

Action Routines Automatic tools can construct a parser for a given context-free grammar E.g. yacc Automatic tools can construct a semantic analyzer for an attribute grammar An ad hoc techniques is to annotate the grammar with executable rules These rules are known as action routines 13 Action Routines 14 7

Static and Dynamic Semantics Attribute grammars add basic semantic rules to the specification of a language They specify static semantics But they are limited to the semantic form that can be checked at compile time Other semantic properties cannot be checked at compile time They are described using dynamic semantics 15 Dynamic Semantics Use to formally specify the behavior of a programming language Semantic-based error detection Correctness proofs There is not a universally accepted notation Operational semantics» Executing statements that represent changes in the state of a real or simulated machine Axiomatic semantics» Using predicate calculus (pre and post-conditions) Denotational semantics» Using recursive function theory 16 8

Semantic Specification The most common way of specifying the semantics of a language is plain english http://www.python.org/doc/current/ref/binary.html http://www.python.org/doc/current/ref/while.html http://java.sun.com/docs/books/jls/first_edition/html/14.do c.html#24588 There is a lack of formal rigor in the semantic specification of programming languages Guess why 17 Reading Assignment Scott s chapter 4 Section 4.1 Section 4.2 Section 4.3 Section 4.4 18 9