#+TITLE: Serene's Language Specification #+AUTHOR: Sameer Rahmani #+SEQ_TODO: TODO(t/!) | DONE(d%) #+TAGS: #+STARTUP: logdrawer logdone logreschedule indent content align constSI entitiespretty nolatexpreview #+OPTIONS: tex:t #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Eule # book style has to be remapped to koma scripts scrbook #+LATEX_CLASS: book #+LATEX_HEADER: \usepackage[english]{babel} #+LATEX_CLASS_OPTIONS: [fontsize=11pt,paper=a5, pagesize=auto] #+LATEX_HEADER: \KOMAoptions{fontsize=11pt} #+LATEX_HEADER: \usepackage[utf8]{inputenc} #+LATEX_HEADER: \usepackage{microtype} #+LATEX_HEADER: \usepackage{pxfonts} #+LATEX_HEADER: \usepackage{amsmath} #+LATEX_HEADER: \usepackage{amssymb} #+LATEX_HEADER: \usepackage{mathabx} #+LATEX_HEADER: \usepackage{tcolorbox} #+LATEX_HEADER: \setlength{\parskip}{1em} #+LATEX_HEADER: \newtcolorbox{infobox}[2][]{colback=cyan!5!white,before skip=14pt,after skip=8pt,colframe=cyan!75!black,sharp corners,title={#2},#1} #+LATEX_HEADER: \newcommand\tab[1][1cm]{\hspace*{#1}} #+LATEX_HEADER: \let\oldsection\section #+LATEX_HEADER: \newcommand\caution[1]{\textcolor{blue}{\textbf{#1}}} #+LATEX_HEADER: \renewcommand\section{\pagebreak\oldsection} #+LATEX_HEADER: \hypersetup{hidelinks} #+LATEX_HEADER: \renewcommand{\contentsname}{Serene's Spec} \clearpage\null\newpage \chapter{Overview of Serene} * Basic Types * Special Forms ** ~def~: ~def~ has the following form: #+BEGIN_SRC lisp (def ) #+END_SRC - Defines a global binding - Returns the name of the binding as a symbol - ~~ has to be a symbol - If ~def~ is not a top level expression, it will create an ~undef~ global binding which will be set to the ~~ when the execution flow reaches the ~def~ itself. * Libraries In terms of static and dynamic libraries, If the library is a Serene library meaning that it is designed to only work with serene (we will see how in a bit), then whatever namespaces that it contains will be added to the compiler and all those namespaces will be map to the library (all the namespaces will point to the same JITDylib). But if the library is a generic static or dynamic library a namespace with the same name as the library minus the suffix will be added to the compiler, for example ~libssh.so~ will be mapped to ~libssh~ namespace. ** Static ** Dynamic ** Object * Unsorted ** Eval Evaluating any form using =eval= will add the form to the namespace containing the =eval= expression. * Glossary - Symbol :: A Lisp Symbol. Just a symbol. A name that might be bound to a value and evaluates to the value. - IR Symbol :: The ~Symbol~ infrastructure essentially provides a non-SSA mechanism in which to refer to an operation in IR symbolically with a name. On MLIR level they are different from *native symbols* even though we use them to refer to *native symbols*. But they don't necessarily map to *native symbols*. - Native Sybol :: As the name suggests native symbols refer to native code symbols. Like those you find in an object file.