This document describes a simple compiler written in Scheme to compile a minimal functional language to x86 assembly. It discusses the key passes of the compiler including type inference, CPS transformation, closure conversion, generation of a low-level IR, register allocation, and machine code generation. While simple, the compiler demonstrates the major stages of a compiler from parsing and semantic analysis to code optimization and back-end code generation.
Scope and Closures in JavaScript
I have made a YouTube video on this topic. So, please feel free to click on the link below to better understand JavaScript.
Video Link: https://www.youtube.com/watch?v=PJJ5qAcNlwQ&list=PL0yG7EPFn4R8lmhfP36cV-G9nx6CEBewo
One definition rule - что это такое, и как с этим житьPlatonov Sergey
В докладе будет разобрано, что-же такое ODR, какие ошибки могут быть из-за нарушения этого правила. Также будет представлен Proof-of-concept утилиты на базе clang tooling по автоматическому поиску таких ошибок.
Scope and Closures in JavaScript
I have made a YouTube video on this topic. So, please feel free to click on the link below to better understand JavaScript.
Video Link: https://www.youtube.com/watch?v=PJJ5qAcNlwQ&list=PL0yG7EPFn4R8lmhfP36cV-G9nx6CEBewo
One definition rule - что это такое, и как с этим житьPlatonov Sergey
В докладе будет разобрано, что-же такое ODR, какие ошибки могут быть из-за нарушения этого правила. Также будет представлен Proof-of-concept утилиты на базе clang tooling по автоматическому поиску таких ошибок.
Slides from my workshop at Hack.LU 2010 in Luxembourg. This workshop introduced the basic concepts of Return Oriented Programming with some hands-on exercises.
The new standard for C++ language has been signed in 2011. This new (extended) language, called C++11, has a number of new semantics (in terms of language constructs) and a number of new standard library support. The major language extensions are discussed in this presentation. The library will be taken up in a later presentation.
Asynchronous operations are getting more and more popular. To the point that we are getting frameworks and environments revolving strictly around that concept. Boost.ASIO, Twisted and node.js are notable example. We will not explore that area. We will focus on techniques for making asynchronous more readable. We will present different currently used solutions. At the end we will introduce coroutines and explain the concept. We will show how these can be integrated with asynchronous code and what we benefit from using coroutines in asynchronous code.
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itSergey Platonov
The talk will look at limitations of compilers when creating fast code and how to make more effective use of both the underlying micro-architecture of modern CPU's and how algorithmic optimizations may have surprising effects on the generated code. We shall discuss several specific CPU architecture features and their pros and cons in relation to creating fast C++ code. We then expand with several algorithmic techniques, not usually well-documented, for making faster, compiler friendly, C++.
Note that we shall not discuss caching and related issues here as they are well documented elsewhere.
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이GangSeok Lee
2012 CodeEngn Conference 06
Secuinside는 코스콤에서 주최, 연합해킹그룹 HARU, 고려대 정보보호대학원에서 주관하는 국제 해킹대회 및 보안컨퍼런스로써 얼마전 개최된 해킹대회 예선전 문제들을 풀기위해 사용한 분석기술과 ASLR과 NX를 우회하는 새로운 익스플로잇 기술에 대해서 소개한다.
http://codeengn.com/conference/06
This presentation was held at CocoaHeads Berlin.
I am explaining the concept of promise with help of OMPromise Library written in ObjC. In the end I present a non complete Swift implementation of Promises concept that I hacked together in couple of hours.
Break Free with Managed Functional Programming: An Introduction to F#IndyMobileNetDev
Dave Fancher presenting at the March Indy .NET Mobile Dev meetup:
Originally developed by Microsoft Research, Cambridge, F# is an open-source, functional-first language in the ML family. Despite its lofty position as a first-class Visual Studio language for the past two releases and its cross-platform availability it hasn't seen widespread adoption in the business world. These slides take you on an introductory tour of F#, exploring how its constructs and terse syntax can allow you to write more stable, maintainable code while keeping you focused on the problem rather than the plumbing.
Slides from my workshop at Hack.LU 2010 in Luxembourg. This workshop introduced the basic concepts of Return Oriented Programming with some hands-on exercises.
The new standard for C++ language has been signed in 2011. This new (extended) language, called C++11, has a number of new semantics (in terms of language constructs) and a number of new standard library support. The major language extensions are discussed in this presentation. The library will be taken up in a later presentation.
Asynchronous operations are getting more and more popular. To the point that we are getting frameworks and environments revolving strictly around that concept. Boost.ASIO, Twisted and node.js are notable example. We will not explore that area. We will focus on techniques for making asynchronous more readable. We will present different currently used solutions. At the end we will introduce coroutines and explain the concept. We will show how these can be integrated with asynchronous code and what we benefit from using coroutines in asynchronous code.
Evgeniy Muralev, Mark Vince, Working with the compiler, not against itSergey Platonov
The talk will look at limitations of compilers when creating fast code and how to make more effective use of both the underlying micro-architecture of modern CPU's and how algorithmic optimizations may have surprising effects on the generated code. We shall discuss several specific CPU architecture features and their pros and cons in relation to creating fast C++ code. We then expand with several algorithmic techniques, not usually well-documented, for making faster, compiler friendly, C++.
Note that we shall not discuss caching and related issues here as they are well documented elsewhere.
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이GangSeok Lee
2012 CodeEngn Conference 06
Secuinside는 코스콤에서 주최, 연합해킹그룹 HARU, 고려대 정보보호대학원에서 주관하는 국제 해킹대회 및 보안컨퍼런스로써 얼마전 개최된 해킹대회 예선전 문제들을 풀기위해 사용한 분석기술과 ASLR과 NX를 우회하는 새로운 익스플로잇 기술에 대해서 소개한다.
http://codeengn.com/conference/06
This presentation was held at CocoaHeads Berlin.
I am explaining the concept of promise with help of OMPromise Library written in ObjC. In the end I present a non complete Swift implementation of Promises concept that I hacked together in couple of hours.
Break Free with Managed Functional Programming: An Introduction to F#IndyMobileNetDev
Dave Fancher presenting at the March Indy .NET Mobile Dev meetup:
Originally developed by Microsoft Research, Cambridge, F# is an open-source, functional-first language in the ML family. Despite its lofty position as a first-class Visual Studio language for the past two releases and its cross-platform availability it hasn't seen widespread adoption in the business world. These slides take you on an introductory tour of F#, exploring how its constructs and terse syntax can allow you to write more stable, maintainable code while keeping you focused on the problem rather than the plumbing.
Ab to shayad hi mujhse muhabbat kare koi
meri aankhon me tum saf nazar ate ho.
Tere Juda Hone ke Baad... Ab Kisi Se Mohabbat Nehi karte....Ae Jaan Choti si To Zindegi hai... Guzar Jayegi Tujhe Yaad Karte Karte.
An approach for load-time hacking using LD_PRELOAD is presented.
We discuss a simple, yet intriguing, strategy for overcoming the limitations discussed in Part 1 (i.e., the first publication given in the reference) of reverse engineering and exploitation using LD_PRELOAD, a dynamic linking technique. In particular, we relax the need for exit(1) in the main function. The essence of the technique is that both the stack pointer (esp) and the base frame pointer (ebp) are carefully adjusted when the wrapper to the library function is called. The proposed solution allows us to safely return to libc after dynamically modifying the control flow in the wrapper to (library) functions.
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]RootedCON
Hace aproximadamente 1 año empezó radare2, un desarrollo paralelo a radare, orientado a ofrecer una API genérica y simple para C, Vala, Genie, python, perl y ruby con el fin de mantener el mínimo de código y presentar un acceso genérico a backends de debugging, formato de fichero, arquitectura, etc.
El framework facilita el uso de plugins o scripting para usar diversos backends de ensamblar/desensamblar, analizar cabeceras, emular, depurar, analizar código, buscar patrones, secuencias binarias entre otras.
Diseñado para ser portable entre múltiples arquitecturas y sistemas operativos, entre ellos, Linux, BSD, Solaris, Windows, x86-32/64, ARM, PowerPC y MIPS.
En la charla se presentará el conjunto de librerías y ejemplos prácticos de uso de esta herramienta.
Introduction to Lisp. A survey of lisp's history, current incarnations and advanced features such as list comprehensions, macros and domain-specific-language [DSL] support.
Getting Started with Raspberry Pi - DCC 2013.1Tom Paulus
The Raspberry Pi is a small credit-card sized linux computer. Developers and hobbyists around the world are creating miraculous applications and projects, and now you can join them. Last year we presented Raspberry Pi, What We Have Learned So Far, This year's presentation covers the first steps to using your Pi. From the basics, like burning your SD Card to creating a News Reader, you will learn GPIO Basics and simple Python tools. Communication between other components using SPI or I2C will also be covered. It is recommended, but not required that you have a Raspberry Pi, some knowledge of Python and simple electronics.
Pragmatic Optimization in Modern Programming - Mastering Compiler OptimizationsMarina Kolpakova
Explains compilers optimizations, gives taxanomy and examples. The examples are mostly compiler for ARM armv7-a and armv8-a targets, but most of optimizations are machine independent.
I am Moffat K. I am a C++ Programming Homework Expert at cpphomeworkhelp.com. I hold a Masters in Programming from London, UK. I have been helping students with their homework for the past 6 years. I solve homework related to C++ Programming.
Visit cpphomeworkhelp.com or email info@cpphomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with C++ Programming Homework.
Gary Bernhardt’s famous WAT talk pokes fun at the weird things in Ruby and JavaScript due to weak typing and operator overloading. But Go can be strange, too. It has its own odd behaviors, some of which we run into every day. Learning about Go’s corner cases teaches us how Go works under the covers.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
How to Create Map Views in the Odoo 17 ERPCeline George
The map views are useful for providing a geographical representation of data. They allow users to visualize and analyze the data in a more intuitive manner.
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
2. Poor Man's Undergraduate Compilers
What compiler?
: https://github.com/suhorng/ss/
A minimal functional language compiler
:
https://github.com/suhorng/compiler13hw/
Compiler homework: Compiling C-- to MIPS,
written in Haskell
How poor?
It is slow
It generates slow codes
‘‘ "
ss
‘‘ "
compiler13hw
2 / 20
3. originally stands for small Scheme
Written in Scheme, compiling a minimal functional
language to x86-32 assembly
No data types, no optimizations, no need for parsers
Only 102 commits!
suhorng@SHHY-ASPIRE2920 /d/code/test/ss (master)
$ wc *.ss *.s
78 363 3645 closure.ss
192 762 9137 code-gen.ss
86 465 3588 cps.ss
11 24 172 issac.ss
168 811 5584 match-case-simple.ss
30 115 991 prelude.ss
313 1495 14334 reg-alloc.ss
130 477 4942 seq-ir-gen.ss
104 304 3090 ss.ss
166 863 8500 type-infer.ss
85 222 2095 sscrt.s
1363 5901 56078 total
ss
ss
3 / 20
4. : A Language
Simply typed λ-calculus with constants and a fixed-point
operator. Strict evaluation.
Terms
Types
ss
e :: = c | x | (+ ) | (× )e1 e2 e1 e2
| (lambda ( …) e)x1 x2
| (ifz con th el)
| (fix e)
| ( …)e1 e2
t :: = N | ()
| →t1 t2
| (× …)t1 t2
4 / 20
15. Tail Calls
Loops
((fix
(lambda (loop)
(lambda (n sum)
(ifz n
sum
(loop (+ n -1) (+ sum n))))))
5 0)
Compare:
int sum = ???;
for (int i = n; i != 0; i = i-1)
sum = sum + n;
Naively implementing tail calls:
Place function call arguments as usual
Move arguments
Adjust frame pointer; jump.
15 / 20
16. Tail Calls
;#######################################
; _ss_function_fn3: ((* Int Int) -> Int)
; parameters:
; ((n Int) (sum Int))
; free variables:
; ((loop ((* Int Int) -> Int)))
;#######################################
_ss_function_fn3_code: ; Note: this function doesn't have a frame
cmp dword [esp + 4], 0
jne .L1
mov eax, [esp + 8]
ret 8 ; terminating loop
.L1:
mov eax, [esp + 8] ; eax := sum
add eax, [esp + 4] ; eax (sum') += n
mov edx, [esp + 4]
add edx, -1 ; edx (n') := n - 1
sub esp, 8 ; place arguments as usual
mov [esp], edx ; | sum' | esp+4
mov [esp + 4], eax ; | n' | esp
mov edi, [edi + 4] ; load closure pointer
lea edx, [esp + 8]
mov ecx, [esp + 8] ; move new arguments up
mov eax, [esp + 4]
mov [edx + 8], eax ; sum' overrides sum,
mov eax, [esp]
mov [edx + 4], eax ; so does n'!
mov [edx], ecx
mov esp, edx
jmp [edi]
16 / 20
17. A compiler for a small subset of C, implemented in
Haskell/suhorng & kevin4314
(nothing special)
Parsing is done using Happy
cf. Happy MonadFix, Easy -pass compiler/CindyLinz
compiler13hw
n
17 / 20
18. Yet the register allocation is still a mess :-D
do
{- read input & parsing -}
let Right parsedAST = Parser.parse input
{- semantic check -}
let compareCompileError ce1 ce2 = compare (errLine ce1) (errLine ce2)
(ast, ces) <- runWriterT $ censor (sortBy compareCompileError) $ do
foldedAST <- Const.constFolding parsedAST
typeInlinedAST <- Desugar.tyDesugar foldedAST
let decayedAST = Desugar.fnArrDesugar typeInlinedAST
symbolAST <- SymTable.buildSymTable decayedAST
typedAST <- TypeCheck.typeCheck symbolAST
return $ NormalizeAST.normalize typedAST
when (not $ null ces) $ mapM_ (putStrLn . show) ces >> exit1
{- code generation -}
let adjustedAST = SethiUllman.seull ast
llir = LLIRTrans.llirTrans adjustedAST
inlinedLLIR = EmptyBlockElim.elim llir
llirFuncs = LLIR.progFuncs inlinedLLIR
llirGlobl = LLIR.progVars inlinedLLIR
llirRegs = LLIR.progRegs inlinedLLIR
let mips = MIPSTrans.transProg $ inlinedLLIR
simpMips = BlockOrder.jumpElim . BlockOrder.blockOrder $ mips
print simpMips
compiler13hw
18 / 20
19. -- all are interpreters
alphaConvAST s@(S.Block _ _) =
runLocal $ alphaConvBlock' s
alphaConvAST (S.Expr ty line rand rators) =
S.Expr ty line rand <$> mapM alphaConvAST rators
alphaConvAST (S.ImplicitCast ty' ty e) =
S.ImplicitCast ty' ty <$> alphaConvAST e
buildMStmt (P.While line whcond whcode) = do
whcond' <- buildMStmts whcond
whcode' <- runLocal (buildMStmt whcode)
return $ S.While line whcond' whcode'
buildMStmt (P.Identifier line name) = do
currScope <- get
upperScope <- ask
let ty = fmap S.varType $ lookup name currScope <|> lookup name upperScope
case ty of
Just S.TTypeSyn -> tell [errorAt line $ "Unexpected type synonym '" ++ name ++ "'"]
Nothing -> tell [errorAt line $ "Undeclared identifier '" ++ name ++ "'"]
otherwise -> return ()
return $ S.Identifier (error "buildMStmt:Identifier") line name
tyCheckAST (S.Expr _ line rator [rand1, rand2]) | rator `elem` logicOps = do
rand1' <- tyCheckAST rand1
rand2' <- tyCheckAST rand2
let (t1, t2) = (S.getType rand1', S.getType rand2')
when ((not $ tyIsScalarType t1) || (not $ tyIsScalarType t2)) $
tell [errorAt line $ "'" ++ show rator ++ "' is applied to operands of non-scalar typ
return $ S.Expr S.TInt line rator [rand1', rand2']
compiler13hw
19 / 20
20. Writing Compiler Using Functional
Languages
Interpreters love you!
Simple AST (Pointers? new, delete? Visitor pattern?
Wat?)
I don't know how to deal with similar ASTs
Don't know how to express constraints on ASTs (e.g.
only allow a subset of operators)
Haven't thought of good ways to implement register
allocation
20 / 20