Cody Scoggins, Dion de Jong, Victor Reynolds References:  902/is-lua-interesting-from-a- programming-language-design-

Slides:



Advertisements
Similar presentations
Lua By: Michael Coffman Peter Sussman. History Lua means ‘moon’ in Portuguese First appeared in 1993 Created by Roberto Ierusalimschy, Luiz Henrique de.
Advertisements

Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
C++ fundamentals.
Lua Matthew Spain | Kerry Zhao. Agenda Overview of Lua Language Details Application Areas Demo Conclusion.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
CS 355 – Programming Languages
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
University of Houston-Clear Lake Proprietary© 1997 Evolution of Programming Languages Basic cycle of improvement –Experience software difficulties –Theory.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Lua: The Programming Language. Some Things that Need to be Said Because of increasing demand for customizable applications, the trend nowadays is to split.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
Introduction to Object Oriented Programming CMSC 331.
CS112: Structure of Programming Languages A smorgasbord of topics in programming languages including programming paradigms and syntax, semantics, implementation.
Prepared by: Elsy Torres Shajida Berry Siobhan Westby.
Games Development 2 Lua Scripting CO3301 Week 6. Contents Introducing Lua –Comparison with Python Lua Language Overview Interfacing Lua with C++
John Imboden. What is Lua  Embeddable scripting language  Creators: Roberto Lerusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes  Designed.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Chapter 3 - Language Design Principles
PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Document Name CONFIDENTIAL Version Control Version No.DateType of ChangesOwner/ Author Date of Review/Expiry The information contained in this document.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
Quiz 1 A sample quiz 1 is linked to the grading page on the course web site. Everything up to and including this Friday’s lecture except that conditionals.
Prepared by Mustafa CAMURLI.  Lua was created in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, members of the Computer.
Lua for TerraME: A Short Introduction Pedro Ribeiro de Andrade São José dos Campos, 2011.
Python : highlights Based on T. K. Prasad’s slides.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
September 24th 2006, aKademy The Design and Implementation of KJSEmbed Richard Moore,
Programming Language History and Evolution
Programming Languages 2nd edition Tucker and Noonan
Introduction to python programming
Web Database Programming Using PHP
Sanjay Ghemawat, Howard Gobioff, Shun-Tak Leung
Fundamentals of Programming I Overview of Programming
Compiler Design (40-414) Main Text Book:
What are they? The Package Repository Client is a set of Tcl scripts that are capable of locating, downloading, and installing packages for both Tcl and.
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
PROGRAMMING LANGUAGES
CIS 200 Test 01 Review.
Compiler Construction (CS-636)
Web Database Programming Using PHP
Java Programming Language
CS 326 Programming Languages, Concepts and Implementation
Representation, Syntax, Paradigms, Types
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
بسم الله الرحمن الرحیم.
Lua for TerraME: A Short Introduction
Implementing Chares in a High-Level Scripting Language
Engineering Innovation Center
Programming Language History and Evolution
AUTOMATED SESSION PLANNING. In the present world, everything has become automated. By, a click everything is being processed. But the preparation of the.
SVTRAININGS. SVTRAININGS Python Overview  Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed.
MIS Professor Sandvig MIS 324 Professor Sandvig
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
Introduction to Python
Ada – 1983 History’s largest design effort
Topics Introduction Hardware and Software How Computers Store Data
Closure Representations in Higher-Order Programming Languages
Operating Systems.
PHP.
More Object-Oriented Programming
From C++ to Java Java history: Oak, toaster-ovens, internet language, panacea What it is O-O language, not a hybrid (cf. C++) compiled to byte-code, executed.
What is Lua? Brandon Burgess Csc 415.
Representation, Syntax, Paradigms, Types
Catharine West Bo Aye Saljin LaRocca references
Python Primer 1: Types and Operators
Introduction to Data Structure
Representation, Syntax, Paradigms, Types
Java History, Editions, Version Features
ICOM 4029 Fall 2003 Lecture 2 (Adapted from Prof. Necula UCB CS 164)
Presentation transcript:

Cody Scoggins, Dion de Jong, Victor Reynolds References:  902/is-lua-interesting-from-a- programming-language-design- perspective 902/is-lua-interesting-from-a- programming-language-design- perspective  overview.htm overview.htm  ming/lua-good-different-bad-and-ugly- parts ming/lua-good-different-bad-and-ugly- parts  ramming_language) ramming_language)   375/what-are-lua-coroutines-even-for- why-doesnt-this-code-work-as-i-expect-it 375/what-are-lua-coroutines-even-for- why-doesnt-this-code-work-as-i-expect-it  #Common_uses #Common_uses   users.org/wiki/LuaVersusPython users.org/wiki/LuaVersusPython  The A-Z of Programming Languages

 Overview  Scripting language  Named after language it replaced (SOL, “Simple Object Language”)  Paradigms:  Scripting, imperative, functional  Used today in many applications (such as Adobe Lightroom)  Data description constructs based on associative arrays and extensible semantics  Dynamically typed, runs by interpreting bytecode for a register-based virtual machine  Automatic memory management with incremental garbage collection

 History  Created by Prof. Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes  Worked for Tecgraf, based in Brazil  Bottom-up creation style/method  Keep the language simple and small  Keep the implementation simple, small, fast, portable, and free  Designed by a committee of three people  Real users since day one

 History (cont’d.)  DEL -> Sol -> Lua  Rather than adopt another language (Tcl), decision was made to create new language (Lua), a modification of Sol  Wanted a light, generic language  Since version one, improvements have been demanded from users, such as performance increases, newer functionality, etc.  Version 2 onwards, decision was made to always try to improve the language, even at the cost of minor compatibility issues with previous versions  Some functionality was more difficult to implement, so initially it was just postponed until later and worked around until a solution could later be determined (Ex. Lexical scoping, wanted since version 2.2, not actually implemented until version 5.0)

  Lua = Fast, Small, Portable, easy-to-use, embeddable, and extendable.  Extendable scripting language = unique b/c overall package = highly refined.  Other scripting languages wish “To claim to be "as fast as Lua.  Small = 1/8 the size of the Python, Source code = lines, interpreter = 180 kB.  Easy Integration  Interpreter = ANSI C  Run on everything  Embedding = easy w/ API  b/c user-defined abstract types are kept.  “Multi-paradigm” = small set of general features = extended to fit problems  Avoid rules, allow freedom, adapt to problems. Design

  No built in namespaces, classes, or inheritance.  Tables + first-class function = classes  Inheritance implemented with metatables.  How? Lua object generation = assign characteristics & functions. Object = assigned metatable (holds keys to associated functions/values and points to super-object)  New function = override function & store in metatable.  Function call  Check object definition, then object’s metatable, if there is no result, Lua will then check the metatable and attempt to match a key there, if no match  check the base class’s metatable. Metatables: Code Sidebar: Classes: Account = {} Account.__index = Account function Account.create(balance) local acnt = {} setmetatable(acnt,Account) acnt.balance = balance return acnt End -- new object -- handle lookup -- initialize object

  No Coroutines  Lua choose reenter a routine or pause it at will = multi-tasking.  What if task has 100’s of coroutines but only needs 15 at a time?  Can selectively start or pause & store the on the stack  Allows State machines, the Actor Model, Generators for streams, and communicating sequential processes. Coroutines: Code Sidebar: -- level script -- a volcano erupts every 2 minutes function level_with_volcano( interface ) while true do wait(seconds(5)) start_eruption_volcano() wait(frames(10)) s = play("rumble_sound") wait( end_of(s) ) start_camera_shake() -- more stuff wait(minutes(2)) end

  Only data types = boolean, numbers (double floats), and strings.  No Arrays, sets, lists, or records.  First-class functions = functional programming.  Full lexical scoping  Stack with direct indexing.  Marshalling data between C and Lua = Arguments  stack  Tables and strings indexed starting at 1, not 0.  Assigned value of nil = remove the value from table.  No brackets for conditionals!  Functions can return multiple values Other strange Tidbits:

 Lua vs Python  Python  more beginner documentation  whitespace sensitive  More extensive Unicode support  has a remote debugger  dictates a specific model for OO programming  Lua  simpler, more minimalistic syntax  uses less memory  faster interpreter  does not dictate any particular OO system, build your own and tailor it to your needs

 Short Program (Part 1)

 Short Program (Part 2)

 Short Program (Part 3)