Update README.md for 1.3 version

This commit is contained in:
Roman Venediktov 2024-07-09 14:53:56 +02:00
parent b444aa53e8
commit acc697206e
10 changed files with 49 additions and 46 deletions

View file

@ -1,9 +1,9 @@
| Lama 1.2 | | Lama 1.3 |
| ------------------- | |---------------------|
| [![Lama 1.2][1]][2] | | [![Lama 1.3][1]][2] |
[1]: https://github.com/PLTools/Lama/Lama/workflows/Build/badge.svg?branch=1.10 [1]: https://github.com/PLTools/Lama/Lama/workflows/Build/badge.svg?branch=1.30
[2]: https://github.com/PLTools/Lama//Lama/actions [2]: https://github.com/PLTools/Lama/Lama/actions
# Lama # Lama
@ -27,8 +27,7 @@ The lack of a type system (a vital feature for a real-world language
for software engineering) is an intensional decision that allows showing the unchained diversity of runtime behaviors, including those that a typical type system is called to prevent. for software engineering) is an intensional decision that allows showing the unchained diversity of runtime behaviors, including those that a typical type system is called to prevent.
On the other hand the language can be used in the future as a raw substrate to apply various ways of software verification (including type systems). On the other hand the language can be used in the future as a raw substrate to apply various ways of software verification (including type systems).
The current implementation contains a native code compiler for **x86-32**, written in **OCaml**, a runtime library with garbage-collection support, written in **C**, and a small standard library, written in ![lama](lama.svg) itself. The current implementation contains a native code compiler for **x86-64**, written in **OCaml**, a runtime library with garbage-collection support, written in **C**, and a small standard library, written in ![lama](lama.svg) itself.
The native code compiler uses **gcc** as a toolchain.
In addition, a source-level reference interpreter is implemented as well as a compiler to a small stack machine. In addition, a source-level reference interpreter is implemented as well as a compiler to a small stack machine.
The stack machine code can in turn be either interpreted on a stack machine interpreter, or used as an intermediate representation by the native code compiler. The stack machine code can in turn be either interpreted on a stack machine interpreter, or used as an intermediate representation by the native code compiler.
@ -39,9 +38,7 @@ The language specification can be found [here](lama-spec.pdf).
## Installation ## Installation
Supported target: GNU/Linux x86_32 (x86_64 by running 32-bit mode) Supported target: GNU/Linux x86_64, MacOS x86_64 (arm using Rosetta).
***Mac*** users should use either a virtual machine or docker with a Linux distributive inside.
***Windows*** users should get Windows Subsystem for Linux a.k.a WSL (recommended) or cygwin. ***Windows*** users should get Windows Subsystem for Linux a.k.a WSL (recommended) or cygwin.
Ubuntu-based variant of WSL is recommended. Ubuntu-based variant of WSL is recommended.
@ -52,14 +49,9 @@ Ubuntu-based variant of WSL is recommended.
For example, (for Debian-based GNU/Linux): For example, (for Debian-based GNU/Linux):
```bash ```bash
$ sudo apt install gcc-multilib sudo apt install gcc-multilib
``` ```
On some versions, you need to install the additional package `lib32gcc-9-dev` in case of errors like
```
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a when searching for -lgcc
```
- [opam](http://opam.ocaml.org) (>= 2.0.4) - [opam](http://opam.ocaml.org) (>= 2.0.4)
- [OCaml](http://ocaml.org) (>= 4.10.1). *Optional* because it can be easily installed through opam. - [OCaml](http://ocaml.org) (>= 4.10.1). *Optional* because it can be easily installed through opam.
Compiler variant with `flambda` switch is recommended. Compiler variant with `flambda` switch is recommended.
@ -71,10 +63,7 @@ Ubuntu-based variant of WSL is recommended.
1. Install the right [switch](https://opam.ocaml.org/doc/Manual.html#Switches) for the OCaml compiler 1. Install the right [switch](https://opam.ocaml.org/doc/Manual.html#Switches) for the OCaml compiler
```bash ```bash
# for fresh opam opam switch create lama --packages=ocaml-variants.4.14.0+options,ocaml-option-flambda
$ opam switch create lama --packages=ocaml-variants.4.14.0+options,ocaml-option-flambda
# for old opam
$ opam switch create lama ocaml-variants.4.13.1+flambda
``` ```
* In the above command: * In the above command:
@ -85,8 +74,7 @@ Ubuntu-based variant of WSL is recommended.
2. Update PATH variable for the fresh switch. (You can add these commands to your `~/.bashrc` for convenience but they should be added by `opam`) 2. Update PATH variable for the fresh switch. (You can add these commands to your `~/.bashrc` for convenience but they should be added by `opam`)
```bash ```bash
$ export OPAMSWITCH=lama eval $(opam env --switch=lama --set-switch)
$ eval $(opam env)
``` ```
* Check that the OCaml compiler is now available in PATH by running `which ocamlc`; it should answer with `/home/user/.opam/lama/bin/ocamlc` (or similar) and `ocamlc -v` should answer with * Check that the OCaml compiler is now available in PATH by running `which ocamlc`; it should answer with `/home/user/.opam/lama/bin/ocamlc` (or similar) and `ocamlc -v` should answer with
@ -98,16 +86,16 @@ Ubuntu-based variant of WSL is recommended.
3. Pin Lama package using `opam` and right URL (remember of "#" being a comment character in various shells) 3. Pin Lama package using `opam` and right URL (remember of "#" being a comment character in various shells)
```bash ```bash
$ opam pin add Lama https://github.com/PLTools/Lama.git\#1.2 --no-action opam pin add Lama https://github.com/PLTools/Lama.git\#1.30 --no-action
``` ```
The extra '#' sign is added because in various Shells it is the start of a comment The extra '#' sign is added because in various Shells it is the start of a comment
4. Install *dep*endencies on system-wide *ext*ernal packages and `lama` itself after that. 4. Install dependencies on system-wide external packages and `lama` itself after that.
```bash ```bash
$ opam depext Lama --yes opam depext Lama --yes
$ opam install Lama --yes opam install Lama --yes
``` ```
5. Check that `lamac` executable was installed: `which lamac` should answer with 5. Check that `lamac` executable was installed: `which lamac` should answer with
@ -125,6 +113,11 @@ It should build a local compiler `src/lamac` and a few tutorial executables in `
* [Plugin for VS Code](https://marketplace.visualstudio.com/items?itemName=arsavelev.lsp-lama) * [Plugin for VS Code](https://marketplace.visualstudio.com/items?itemName=arsavelev.lsp-lama)
### Changes in Lama 1.3
* Migrated from x86-32 to x86-64 architecture.
* Added `let ... in ...` construct.
### Changes in Lama 1.2 ### Changes in Lama 1.2
* New garbage collector: single-threaded stop-the-world `LISP2` (see GC Handbook for details: [1st edition](https://www.cs.kent.ac.uk/people/staff/rej/gcbook/), [2nd edition](http://gchandbook.org/)) [mark-compact](https://www.memorymanagement.org/glossary/m.html#term-mark-compact). * New garbage collector: single-threaded stop-the-world `LISP2` (see GC Handbook for details: [1st edition](https://www.cs.kent.ac.uk/people/staff/rej/gcbook/), [2nd edition](http://gchandbook.org/)) [mark-compact](https://www.memorymanagement.org/glossary/m.html#term-mark-compact).

Binary file not shown.

View file

@ -29,9 +29,9 @@ of runtime behaviors, including those which a typical type system is called to p
the language can be used in future as a raw substrate to apply various ways of software verification (including the language can be used in future as a raw substrate to apply various ways of software verification (including
type systems) on. type systems) on.
The current implementation contains a native code compiler for \textsc{x86-32}, written The current implementation contains a native code compiler for \textsc{x86-64}, written
in \textsc{OCaml}, a runtime library with garbage-collection support, written in \textsc{C}, and a small in \textsc{OCaml}, a runtime library with garbage-collection support, written in \textsc{C}, and a small
standard library, written in \lama itself. The native code compiler uses \textsc{gcc} as a toolchain. standard library, written in \lama itself.
In addition, a source-level reference interpreter is implemented as well as a compiler to a small In addition, a source-level reference interpreter is implemented as well as a compiler to a small
stack machine. The stack machine code can in turn be either interpreted on a stack machine interpreter, or stack machine. The stack machine code can in turn be either interpreted on a stack machine interpreter, or

View file

@ -2,7 +2,7 @@
\label{sec:wellformedness} \label{sec:wellformedness}
{ {
\newcommand{\Ref}{\primi{Ref}{}} \renewcommand{\Ref}{\primi{Ref}{}}
\newcommand{\Val}{\primi{Val}{}} \newcommand{\Val}{\primi{Val}{}}
\newcommand{\Void}{\primi{Void}{}} \newcommand{\Void}{\primi{Void}{}}
\newcommand{\Weak}{\primi{Weak}{}} \newcommand{\Weak}{\primi{Weak}{}}

View file

@ -6,7 +6,7 @@
\label{sec:lexical_structure} \label{sec:lexical_structure}
The character set for the language is \textsc{ASCII}, case-sensitive. In the following lexical description we will use The character set for the language is \textsc{ASCII}, case-sensitive. In the following lexical description we will use
the GNU Regexp syntax~\cite{GNULib} in lexical definitions. the POSIX-Extended Regular Expressions in lexical definitions.
\subsection{Whitespaces and Comments} \subsection{Whitespaces and Comments}
@ -83,7 +83,7 @@ The following identifiers are reserved for keywords:
after array at before box case do elif else after array at before box case do elif else
esac eta false fi for fun if import infix esac eta false fi for fun if import infix
infixl infixr lazy od of public sexp skip str infixl infixr lazy od of public sexp skip str
syntax then true val var while syntax then true val var while let in
\end{lstlisting} \end{lstlisting}
\subsection{Infix Operators} \subsection{Infix Operators}

View file

@ -40,7 +40,7 @@ property ``$e$ is a reference''. The result of assignment operator coincides wit
assigns 3 to both "\lstinline|x|" and "\lstinline|y|". assigns 3 to both "\lstinline|x|" and "\lstinline|y|".
\begin{figure}[h] \begin{figure}[h]
\newcommand{\Ref}[1]{\mathcal{R}\,({#1})} \renewcommand{\Ref}[1]{\mathcal{R}\,({#1})}
\renewcommand{\arraystretch}{4} \renewcommand{\arraystretch}{4}
\[ \[
\begin{array}{cc} \begin{array}{cc}
@ -108,7 +108,8 @@ designates an anonymous functional value in the form of a closure.
& & \nonterm{whileDoExpression}&\alt\\ & & \nonterm{whileDoExpression}&\alt\\
& & \nonterm{doWhileExpression}&\alt\\ & & \nonterm{doWhileExpression}&\alt\\
& & \nonterm{forExpression}&\alt\\ & & \nonterm{forExpression}&\alt\\
& & \nonterm{caseExpression}& & & \nonterm{caseExpression}&\alt\\
& & \nonterm{letExpression}&
\end{array} \end{array}
\] \]
\caption{Expression concrete syntax} \caption{Expression concrete syntax}
@ -134,7 +135,15 @@ Expression \lstinline|skip| can be used to designate a no-value when no action i
\label{composite_expressions} \label{composite_expressions}
\end{figure} \end{figure}
There are three forms of expressions to specify composite values: arrays, lists and S-expressions (see Fig.~\ref{composite_expressions}). There are three forms of expressions to specify composite values: arrays, lists and S-expressions (see Fig.~\ref{composite_expressions}).
\FloatBarrier
\subsection{Let Expressions}
TODO
\FloatBarrier
\subsection{Conditional Expressions} \subsection{Conditional Expressions}

View file

@ -4,11 +4,10 @@
\chapter{Implementation-dependent Limitations} \chapter{Implementation-dependent Limitations}
\label{sec:limitations} \label{sec:limitations}
The following limitations are in effect for \textsc{x86-32} platform implementation: The following limitations are in effect for \textsc{x86-64} platform implementation:
\begin{itemize} \begin{itemize}
\item the range of representable integers is [-1073741824..1073741823] (31-bit signed in two-complement representation); \item the range of representable integers is \newline [-4611686018427387905..4611686018427387904] (63-bit signed in two-complement representation);
\item the maximal length of array/string/number of S-expression parameters is 536870911 (29-bit unsigned integer); \item the maximal length of array/string/number of S-expression parameters is 2305843009213693952 (61-bit unsigned integer);
\item the minimal address space size is 2GB (garbage collector requirement); \item the maximal number of S-expression constructor name symbols taken into account is 9.
\item the maximal number of S-expression constructor name symbols taken into account is 5.
\end{itemize} \end{itemize}

View file

@ -4,7 +4,8 @@
\chapter{Debugging Support} \chapter{Debugging Support}
\label{sec:debugging} \label{sec:debugging}
Current implementation supports a minimalistic debugging with \textsc{GDB}~\cite{gdb}. In order to include the debug information into object files/executable these files Current implementation supports a minimalistic debugging with \textsc{GDB}~\cite{gdb} for the Linux target only.
In order to include the debug information into object files/executable these files
have to be compiled with the command-line option "\texttt{-g}" (see Section~\ref{sec:driver}). have to be compiled with the command-line option "\texttt{-g}" (see Section~\ref{sec:driver}).
The following debugging features are supported: The following debugging features are supported:
@ -36,4 +37,5 @@ The following customized commands are available:
\item "\texttt{pc }$i$", where "$i$" is an integer number. The commands prints a value of $i$-component of current closure. \item "\texttt{pc }$i$", where "$i$" is an integer number. The commands prints a value of $i$-component of current closure.
\end{itemize} \end{itemize}
For the MacOS target the debugging is supported with \textsc{LLDB}.
But debugging features are not available.

View file

@ -95,7 +95,7 @@ is automatically created and closed within the call.}
\descr{\lstinline|fun fprintf (file, fmt, ...)|}{Same as "\lstinline|printf|", but outputs to a given file. The file argument should be that acquired \descr{\lstinline|fun fprintf (file, fmt, ...)|}{Same as "\lstinline|printf|", but outputs to a given file. The file argument should be that acquired
by \lstinline|fopen| function.} by \lstinline|fopen| function.}
\descr{\lstinline|fun regexp (str)|}{Compiles a string representation of a regular expression (as per GNULib's regexp~\cite{GNULib}) into \descr{\lstinline|fun regexp (str)|}{Compiles a string representation of a regular expression (as per POSIX-Extended Regular Expressions syntax) into
an internal representation. The return value is a external pointer to the internal representation.} an internal representation. The return value is a external pointer to the internal representation.}
\descr{\lstinline|fun regexpMatch (pattern, subj, pos)|}{Matches a string "\lstinline{subj}", starting from the position "\lstinline|pos|", \descr{\lstinline|fun regexpMatch (pattern, subj, pos)|}{Matches a string "\lstinline{subj}", starting from the position "\lstinline|pos|",

View file

@ -93,7 +93,7 @@
\newcommand{\descr}[2]{\smallskip{#1}\begin{itemize}[noitemsep,topsep=0pt]\item[]{#2}\end{itemize}} \newcommand{\descr}[2]{\smallskip{#1}\begin{itemize}[noitemsep,topsep=0pt]\item[]{#2}\end{itemize}}
\lstdefinelanguage{abslama}{ \lstdefinelanguage{abslama}{
keywords={skip,if,then,else,elif,fi,while,do,od,for,fun,public,import, keywords={skip,if,then,else,elif,fi,while,do,od,for,fun,public,import,let,in,
box,val,var,case,of,esac,when,box,str,sexp,array,infix,infixl,infixr,at,before,after,true,false,eta,lazy,syntax,ref,ignore,elemRef}, box,val,var,case,of,esac,when,box,str,sexp,array,infix,infixl,infixr,at,before,after,true,false,eta,lazy,syntax,ref,ignore,elemRef},
sensitive=true, sensitive=true,
basicstyle=\small, basicstyle=\small,
@ -109,8 +109,8 @@ morecomment=[l][\ttfamily]{--}
} }
\lstdefinelanguage{lama}{ \lstdefinelanguage{lama}{
keywords={skip,if,then,else,elif,fi,while,do,od,for,fun,public,import, keywords={skip,if,then,else,elif,fi,while,do,od,for,fun,public,import,let,in,
box,val, var,case,of,esac,when,box,str,sexp,array,infix,infixl,infixr,at,before,after,true,false,eta,lazy,syntax}, box,val,var,case,of,esac,when,box,str,sexp,array,infix,infixl,infixr,at,before,after,true,false,eta,lazy,syntax},
sensitive=true, sensitive=true,
basicstyle=\small, basicstyle=\small,
%commentstyle=\scriptsize\rmfamily, %commentstyle=\scriptsize\rmfamily,
@ -168,7 +168,7 @@ language=lama
{\huge\bfseries \lama Language Specification}\\[0.4cm] % Title of your document {\huge\bfseries \lama Language Specification}\\[0.4cm] % Title of your document
{\textsc{Version 1.10}} {\textsc{Version 1.30}}
\HRule\\[1.5cm] \HRule\\[1.5cm]