Scripting with Luerl

Similar documents
Luerl - an implementation of Lua on the Erlang VM

Implementing languages on the Erlang VM

LFE - a lisp on the Erlang VM

Erlang 101. Google Doc

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++

Functional Programming In Real Life

BUILDING A SCALABLE MOBILE GAME BACKEND IN ELIXIR. Petri Kero CTO / Ministry of Games

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory

Erlang and Node.JS or, better, Criteria for evaluating technology. Lev Walkin, CTO

Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz

the package manager for Lua

FRANCESCO CESARINI. presents ERLANG/OTP. Francesco Cesarini Erlang

Erlang. Joe Armstrong.

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University

Last update: Sat Mar 18 22:00:08 GMT 2017 (build 21)

29811c01.qxd:WileyRedTightPart 3/27/08 9:32 AM Page 1. Part. Learning to Program COPYRIGHTED MATERIAL

and the only thing missing is u Integrating Lua and Erlang with an overview of scripting options

The Disembedding of a Brazilian Software. Roberto Ierusalimschy

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

Testing Driven Development. Advanced Programming

Introduction. A. Bellaachia Page: 1

RADU POPESCU IMPROVING THE WRITE SCALABILITY OF THE CERNVM FILE SYSTEM WITH ERLANG/OTP

Programming Language Impact on the Development of Distributed Systems

Some thorny points in the design of Lua: a personal perspective

This tutorial covers various topics ranging from the basics of Lua to its scope in various applications.

Haskell in the Software Industry

PyPy - How to not write Virtual Machines for Dynamic Languages

All you need is fun. Cons T Åhs Keeper of The Code

A History of the Erlang VM

Advanced Databases ( CIS 6930) Fall Instructor: Dr. Markus Schneider. Group 17 Anirudh Sarma Bhaskara Sreeharsha Poluru Ameya Devbhankar

Overview. Distributed Computing with Oz/Mozart (VRH 11) Mozart research at a glance. Basic principles. Language design.

TensorFlow: A System for Learning-Scale Machine Learning. Google Brain

Grand Central Dispatch and NSOperation. CSCI 5828: Foundations of Software Engineering Lecture 28 12/03/2015

Erlang. Types, Abstract Form & Core. Salvador Tamarit Muñoz. Universitat Politècnica de València

Concurrency: what, why, how

The HALFWORD HEAP EMULATOR

ERLANG EVOLVES FOR MULTI-CORE AND CLOUD ENVIRONMENTS

Message Passing. Advanced Operating Systems Tutorial 7

Scott Meder Senior Regional Sales Manager

Common Lisp. In Practical Usage

Spotfire and Tableau Positioning. Summary

Computer Fundamentals: Operating Systems, Concurrency. Dr Robert Harle

Course introduction. Advanced Compiler Construction Michel Schinz

Introduction to Python. Didzis Gosko

Haskell Functional Programming

Robot Programming with Lisp

Concurrency: what, why, how

WOMBATOAM OPERATIONS & MAINTENANCE FOR ERLANG & ELIXIR SYSTEMS

WOMBATOAM OPERATIONS & MAINTENANCE FOR ERLANG & ELIXIR SYSTEMS

VoltDB vs. Redis Benchmark

DISTRIBUTED SYSTEMS [COMP9243] Lecture 8a: Cloud Computing WHAT IS CLOUD COMPUTING? 2. Slide 3. Slide 1. Why is it called Cloud?

Haskell Functional Programming

Building a video conference (WebRTC) controller with Elixir. Or how Elixir was introduced into VoiSmart

Building a Multi-Language Interpreter Engine

A Comparison of the LUA Procedure and the SAS Macro Facility

IMGD 4000 Technical Game Development II Scripting

Erlang and Concurrency. André Pang Rising Sun Research

NOSQL OPERATIONAL CHECKLIST

September 15th, Finagle + Java. A love story (

An Introduction to Tilde

Technical Game Development II IMGD 4000 (D 11) 1. having agents follow pre-set actions rather than choosing them dynamically

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

Towards Lean 4: Sebastian Ullrich 1, Leonardo de Moura 2.

LuaInterface: Scripting the.net CLR with Lua

2015 Erlang Solutions Ltd

Outline. When we last saw our heros. Language Issues. Announcements: Selecting a Language FORTRAN C MATLAB Java

concurrent programming XXL

Seminar on Languages for Scientific Computing Aachen, 6 Feb Navid Abbaszadeh.

History of the development of Lua

RabbitMQ: Messaging in the Cloud

The Golden Trinity of Erlang How Something Simple Has Real Business Value

Chapter 11 :: Functional Languages

Unity Tutorial. Fall /15-666

Dispatch techniques and closure representations

How you can benefit from using. javier

Redis as a Reliable Work Queue. Percona University

Functional Programming Lecture 13: FP in the Real World

ZEROMQ: MESSAGING FOR MANY APPLICATIONS BY PIETER HINTJENS DOWNLOAD EBOOK : ZEROMQ: MESSAGING FOR MANY APPLICATIONS BY PIETER HINTJENS PDF

Multicore OCaml. Stephen Dolan Leo White Anil Madhavapeddy. University of Cambridge. OCaml 2014 September 5, Multicore OCaml

Haskell in the corporate environment. Jeff Polakow October 17, 2008

Upgrade Your MuleESB with Solace s Messaging Infrastructure

Lua Quick Reference. Mitchell

Progress report of "Ruby 3 Concurrency"

CloudI Integration Framework. Chicago Erlang User Group May 27, 2015

2 The Conguration Language Lua as a Framework Lua is a general purpose conguration language that arose from the need of TeCGraf 1 to use a single exte

Lecture 09. Ada to Software Engineering. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

Under the Compiler's Hood: Supercharge Your PLAYSTATION 3 (PS3 ) Code. Understanding your compiler is the key to success in the gaming world.

Programming Paradigms

Multimedia-Programmierung Übung 3

Which application/messaging protocol is right for me?

Massive IM Scalability using WebSockets Michał Ślaski

Pagely.com implements log analytics with AWS Glue and Amazon Athena using Beyondsoft s ConvergDB

Virtual machines (e.g., VMware)

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

Executive Summary. It is important for a Java Programmer to understand the power and limitations of concurrent programming in Java using threads.

Scala, Your Next Programming Language

MoarVM. A metamodel-focused runtime for NQP and Rakudo. Jonathan Worthington

Piqi-RPC. Exposing Erlang services via JSON, XML and Google Protocol Buffers over HTTP. Friday, March 25, 2011

Implementing Riak in Erlang: Benefits and Challenges

Transcription:

Scripting with Luerl

Luerl Luerl is an implementation of standard Lua written in Erlang/OTP. Lua is a powerful, efficient, lightweight, embeddable scripting language common in games, machine learning, IoT devices and scientific computing research. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description. https://github.com/rvirding/luerl https://luerl.org

Lua...

The Lua Language Lua was born out of necessity, initially developed as a result of strict trade barriers instituted by the Brazilian government. Created in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes at the Pontifical Catholic University of Rio de Janeiro, in Brazil. Lua is explicitly designed as scripting language to be embedded into applications build on other languages.

The Lua Language Originally influenced by Tcl (scripting, embedded), Modula, SNOBOL and AWK (associative arrays), LISP with their single, data-structure mechanism (the list), and Scheme; first class anonymous functions with lexical scope (closures).

The Lua Language Lua is an embedded language: meaning that is not a stand-alone package, but a library that links to other applications to extend them. The ability to be used as a library is what makes Lua an extension language. Lua can register new functions in the environment; such functions are implemented in C (or another language) this add features that cannot be written directly in Lua.

The Lua Language These two views of Lua the extension language and as an extensible language correspond to two kinds of interaction between C and Lua. In the first kind, C its the application language and Lua is the library. In the second kind, Lua its the application language and C is the library. Both of them use the same API to communicate with Lua, the so called C API.

The Lua Language Lua programs are not interpreted directly from the source code, but are compiled into bytecode, which runs into the Lua virtual machine. The compilation process is typically invisible and is performed during run-time.

Uses of Lua - Widely used in some niches not just game development - Embedded systems; TVs(Samsung), routers(cisco), mobiles(huawei),... - Scripting for applications; Wikipedia, Wireshark, Nmap, VLC Media Player - Very popular in systems infrastructure; nginx, haproxy, asterisk, kamailio - Web development; Sailor, OpenResty, Lapis, Turbo - Image manipulation; Adobe Lightroom - API Gateways; Kong - Deep Learning; Torch

Erlang...

The Erlang Language Erlang is a concurrent, functional language which runs on its own scalable, distributed, fault-tolerant, soft real-time, highly available VM called the BEAM.

The BEAM ecosystem Multilingual from the start, the Erlang ecosystem with all its languages is build for and runs on the BEAM VM, the Erlang language and the OTP framework. Erlang, Elixir, LFE, Luerl, Erlog, Efene, Bragful, Alpaca, Joxa...

The BEAM internal properties - Lightweight, massive concurrency - Asynchronous communication - Process isolation - Error handling - Hot code replacement - Support for introspection and monitoring We rarely have to worry about this properties, except for receiving messages!

The BEAM external properties - Immutable data - Pattern matching - Functional language - Predefined set of data types - Modules - No global data These are what we see directly in the BEAM ecosystem of languages.

Uses of Erlang - Widely used in some niches it s not just a telecom language - Web development; Cowboy (99s) - Communication systems; MongooseIM(Erlang Solutions), WhatsApp(FB), ejabberd (Process One),... - Operations and monitoring; WombatOAM (Erlang Solutions) - Message brokers; RabbitMQ (Pivotal) - Very popular in cluster databases; Riak (R.I.P Basho), SimpleDB (Amazon)

So, why Luerl?...

Well Robert likes to implement languages

Luerl features Luerl should allow you to fast switch between Lua and Erlang, introducing a new way to use very small bits of logic programmed in Lua, inside an Erlang application, which means that: - Programs are written in at least two languages; a scripting and system language. - The system language implements the hard parts of the application; algorithms, data structures, there is little change at this level. - Scripting glues together the hard parts; this level is flexible, easy to change.

Millions of processes Luerl presents an environment that allows you to effortlessly run millions of Lua processes concurrently and in parallel, levering the famed processes implementation of the BEAM VM.

A note on coroutines There are no coroutines in Luerl, this could seem counterintuitive coming from a solid Lua background, but they are not needed in the BEAM ecosystem, here we use processes; concurrent, lightweight asynchronous processes.

Uses of Luerl Lua is used in various products build with Erlang and open-source projects around the world, including several games, API Gateways, and StarCraft AI bots.

The trade-offs Lua is not good for: - Concurrency and multi-core parallelism - The standard library is not very large - DIY approach to life (Do It Yourself) Erlang is not good for: - Heavy number crunching - Global, shared, mutable state - Scripting, yes, we know about escript but.. really?

Luerl: The goal A proper implementation of the Lua language. - It should look and behave the same as Lua - It should include the standard libraries - It should interface well with Erlang Luerl is a complete reimplementation of the Lua language including a Luerl Erlang API that match the Lua C API available on standard Lua.

Luerl: The result Luerl is a successful implementation of Lua in Erlang - except goto, _ENV and coroutines It, also has great interaction between Erlang and friends - Easy for Erlang to call Lua and Lua to call Erlang - Compatible with Erlang concurrency and error handling.

Luerl: The result Luerl standard library implemented - Functions - Modules - String manipulation - Table mechanism - Math functions - Bitwise operators - Very few I/O and OS facilities

Luerl: The result - Extendable if required to call Lua from Erlang - Straight-forward to call Erlang from Lua - No C interface! - (Erlang application programming interface instead of the Lua C API.)

Luerl: The result - VM and compiler A relative straight-forward VM - Similar, but not the same, as the standard Lua one. Compiler optimises the environment handling - Separates purely local environment of blocks and functions from global env Lots of unnecessary information compiled away - Error messages are very basic, but no worries this is in the pipeline.

Luerl: The result - datatypes Lua Luerl nil true/false strings numbers tables functions Atom nil Atom true/false strings binaries floats #tables{} with arrays for keys we have 1...n and #dicts for the rest #function{} or {function, Fun}

Luerl: The result - Lua state The main difficulty of Luerl implementation was the need to implement Lua s mutable global data with Erlang s immutable local data. We keep all Lua state in one data structure explicitly threaded through everything, this threading of stuff is what you typically do in Erlang anyway. Robert implement Luerl s own garbage collector on top of Erlang s collector for Lua state.

Community Luerl embrace both #LuaLang and #Erlang the two of them are simple, diverse and complementary communities and language ecosystems. https://luerl.org https://github.com/rvirding/luerl https://github.com/rvirding/luerl/wiki

Thanks! Barbara Chassoul @chassoula https://nonsense.ws