diff --git a/gitlab-pages/README.md b/gitlab-pages/README.md index 718146e8b..dfa3507be 100644 --- a/gitlab-pages/README.md +++ b/gitlab-pages/README.md @@ -4,6 +4,11 @@ The website will be available at [http://localhost:3000](http://localhost:3000) -```zsh +To get the website running you want to do the commands: + +``` +cd website +npm run version next +cd .. docker-compose up ``` \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/cheat-sheet.md b/gitlab-pages/docs/language-basics/cheat-sheet.md index 4d8510cfa..c754d039f 100644 --- a/gitlab-pages/docs/language-basics/cheat-sheet.md +++ b/gitlab-pages/docs/language-basics/cheat-sheet.md @@ -16,6 +16,7 @@ title: Cheat Sheet |Natural numbers | `42n`, `7n`| |Unit| `unit`| |Boolean|
const hasDriversLicense: bool = False;
const adult: bool = True;
| +|Boolean Logic|
(not True) == False == (False and True) == (False or False)
| |Mutez (micro tez)| `42mtz`, `7mtz` | |Address | `"tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx"`, `"KT1JepfBfMSqkQyf9B1ndvURghGsSB8YCLMD"`| |Addition |`3 + 4`, `3n + 4n`| @@ -26,16 +27,18 @@ title: Cheat Sheet |Includes|```#include "library.ligo"```| |Functions (short form)|
function add (const a : int ; const b : int) : int is
  block { skip } with a + b
| |Functions (long form)|
function add (const a : int ; const b : int) : int is
  block {
    const result: int = a + b;
  } with result
| +| If Statement |
if age < 16 
then fail("Too young to drive.");
else const new_id: int = prev_id + 1;
| |Options|
type middleName is option(string);
const middleName : middleName = Some("Foo");
const middleName : middleName = None;
| |Assignment| ```const age: int = 5;```| |Assignment on an existing variable

*⚠️ This feature is not supported at the top-level scope, you can use it e.g. within functions. Works for Records and Maps as well.*| ```age := 18;```, ```p.age := 21``` | -|Annotations| ```("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)```| +|Type Annotations| ```("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)```| |Variants|
type action is
| Increment of int
| Decrement of int
| |Variant *(pattern)* matching|
const a: action = Increment(5);
case a of
| Increment(n) -> n + 1
| Decrement(n) -> n - 1
end
| |Records|
type person is record
  age: int ;
  name: string ;
end

const john : person = record
  age = 18;
  name = "John Doe";
end

const name: string = john.name;
| -|Maps|
type prices is map(nat, tez);

const prices : prices = map
  10n -> 60mtz;
  50n -> 30mtz;
  100n -> 10mtz;
end

const price: option(tez) = prices[50n];
| +|Maps|
type prices is map(nat, tez);

const prices : prices = map
  10n -> 60mtz;
  50n -> 30mtz;
  100n -> 10mtz;
end

const price: option(tez) = prices[50n];

prices[200n] := 5mtz;
| |Contracts & Accounts|
const destinationAddress : address = "tz1...";
const contract : contract(unit) = get_contract(destinationAddress);
| |Transactions|
const payment : operation = transaction(unit, amount, receiver);
| +|Exception/Failure|`fail("Your descriptive error message for the user goes here.")`| diff --git a/gitlab-pages/docs/language-basics/operators.md b/gitlab-pages/docs/language-basics/operators.md index 3b2dfda6d..9403a0d92 100644 --- a/gitlab-pages/docs/language-basics/operators.md +++ b/gitlab-pages/docs/language-basics/operators.md @@ -11,4 +11,5 @@ title: Operators |--- |--- |--- | | `SENDER` | `sender` | Address that initiated the current transaction | `SOURCE` | `source` | Address that initiated the transaction, which triggered the current transaction. (useful e.g. when there's a transaction sent by another contract) -| `AMOUNT` | `amount` | Amount of tez sent by the transaction that invoked the contract \ No newline at end of file +| `AMOUNT` | `amount` | Amount of tez sent by the transaction that invoked the contract +| `NOW` | `now` | Timestamp of the block whose validation triggered execution of the contract, i.e. current time when the contract is run. \ No newline at end of file diff --git a/gitlab-pages/docs/setup/installation.md b/gitlab-pages/docs/setup/installation.md index 66cef54bb..c9b5c5503 100644 --- a/gitlab-pages/docs/setup/installation.md +++ b/gitlab-pages/docs/setup/installation.md @@ -3,14 +3,19 @@ id: installation title: Installation --- -There are currently two ways to get started with Ligo, both of those will allow you to use the Ligo CLI with your contracts. You can choose to use either the Docker image, or to compile & build the Ligo CLI yourself. +There are currently two ways to get started with Ligo, both of those will allow you to use the Ligo CLI with your contracts. You can choose to use either a Docker image, or to compile & build the Ligo CLI yourself. ## Dockerized installation (recommended) > 🐳 You can find instructions on how to install Docker [here](https://docs.docker.com/install/). -Easiest way to use LIGO is through the Docker image available at [Docker Hub](https://hub.docker.com/r/ligolang/ligo). Sources for the image can be found on [Gitlab](https://gitlab.com/ligolang/ligo/blob/dev/docker/Dockerfile). -You can either run the docker image yourself, or you can setup a global ligo executable as shown below. +It's easiest to use LIGO through one of its Docker images. You have two options, +the first is to use our installation script to set up a globally available LIGO +executable (see below). This manages the Docker bits for you. The second +is to directly use the Docker image available at [Docker Hub](https://hub.docker.com/r/ligolang/ligo). +This lets you run multiple versions and keep your installation(s) self contained, but requires more familiarity with Docker. +Sources for the image can be found on [Gitlab](https://gitlab.com/ligolang/ligo/blob/master/docker/Dockerfile). +If this is your first time using Docker, you probably want to set up a global ligo executable as shown below. ### Setting up a globally available `ligo` executable diff --git a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md index 59970d4a8..079dbb239 100644 --- a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md +++ b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md @@ -59,6 +59,8 @@ current_purchase_price = max_price / available_stock In this tutorial, we'll use LIGO's dockerized version for the sake of simplicity. You can find the installation instructions [here](setup/installation.md#dockerized-installation-recommended). +The best way to install the dockerized LIGO is as a **global executable** through the installation script, as shown in the screenshot below: +
Installing the next version of LIGO's CLI
diff --git a/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md b/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md index f0caa55b8..c59729ff7 100644 --- a/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md +++ b/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md @@ -95,7 +95,7 @@ We are looking to develop a Super Type System that has the following features: The current version explicitly excludes non-essential features which can produce unexpected explosions in gas costs. To alleviate this constraint, we plan to integrate gas benchmarks on all top-level declarations with some fuzzing. This will allow developers and users to estimate the cost of their contracts in real time. ## Getting Started and Contact -Come visit [our website](ligolang.org)! You can also join our [Discord](https://discord.gg/CmTwFM), Riot (*#ligo-public:matrix.org*) or Telegram Chat (Ligo Public channel). +Come visit [our website](https://ligolang.org)! You can also join our [Discord](https://discord.gg/9rhYaEt), Riot (*#ligo-public:matrix.org*) or Telegram Chat (Ligo Public channel). diff --git a/gitlab-pages/website/pages/en/index.js b/gitlab-pages/website/pages/en/index.js index 77a161104..6f08fdde7 100644 --- a/gitlab-pages/website/pages/en/index.js +++ b/gitlab-pages/website/pages/en/index.js @@ -96,7 +96,7 @@ class HomeSplash extends React.Component { - + diff --git a/gitlab-pages/website/static/.well-known/acme-challenge/udfg-WYEzK3rTbfS71zFI7HOr3AvRoa9KMuzObp9wTs b/gitlab-pages/website/static/.well-known/acme-challenge/udfg-WYEzK3rTbfS71zFI7HOr3AvRoa9KMuzObp9wTs new file mode 100644 index 000000000..60384549e --- /dev/null +++ b/gitlab-pages/website/static/.well-known/acme-challenge/udfg-WYEzK3rTbfS71zFI7HOr3AvRoa9KMuzObp9wTs @@ -0,0 +1 @@ +udfg-WYEzK3rTbfS71zFI7HOr3AvRoa9KMuzObp9wTs.4Dc00ftieGaWDmacztwSS7euFOKPULDHjUNzikwPvao \ No newline at end of file diff --git a/index.tar.gz b/index.tar.gz index 145e1522a..022ac1aef 100644 Binary files a/index.tar.gz and b/index.tar.gz differ diff --git a/makefile b/makefile new file mode 100644 index 000000000..069943f5b --- /dev/null +++ b/makefile @@ -0,0 +1,25 @@ +# Use install-deps instead of 'install' because usually 'make install' adds a +# binary to the system path and we don't want to confuse users +install-deps: +# Install ligo/tezos specific system-level dependencies + sudo scripts/install_native_dependencies.sh + +build-deps: +# Create opam dev switch locally for use with Ligo, add merlin/etc + if [ -n "`opam switch show | grep -P ".+/ligo"`" ]; + then exit; else scripts/setup_dev_switch.sh; + fi +# Set up the local ligo opam repository so that it can be built + if [ -n "`opam repo list --safe | grep -P "ligo-opam-repository"`" ]; + then exit; else scripts/setup_ligo_opam_repository.sh; + fi +# Install OCaml build dependencies for Ligo + scripts/install_ligo_with_dependencies.sh + +build: build-deps +# Build Ligo for local dev use + scripts/build_ligo_local.sh + +.ONESHELL: +test: build + scripts/test_ligo.sh diff --git a/packages/ligo/ligo.dev/opam b/packages/ligo/ligo.dev/opam index 4b28508c8..e1e0f283b 100644 --- a/packages/ligo/ligo.dev/opam +++ b/packages/ligo/ligo.dev/opam @@ -18,6 +18,7 @@ depends: [ "proto-alpha-utils" "yojson" "alcotest" { with-test } + "getopt" ] build: [ [ "dune" "build" "-p" name "-j" jobs ] diff --git a/repo b/repo index d4cfe9fd1..3dae795d1 100644 --- a/repo +++ b/repo @@ -1,3 +1,3 @@ opam-version: "2.0" archive-mirrors: "cache" -stamp: "a989886f" +stamp: "b4649b8f" diff --git a/scripts/build_ligo_local.sh b/scripts/build_ligo_local.sh new file mode 100755 index 000000000..85fcb6892 --- /dev/null +++ b/scripts/build_ligo_local.sh @@ -0,0 +1,2 @@ +eval $(opam env) +dune build -p ligo diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh new file mode 100755 index 000000000..4d5e36400 --- /dev/null +++ b/scripts/install_build_environment.sh @@ -0,0 +1,64 @@ +# This script installs opam for the user. It should NOT be included in any makefiles/etc. + +if [ -n "`which opam`" ] +then + if [ -n "`opam --version | grep -P "2\..\.."`" ] + then + echo "Opam 2.x seems to already exist, exiting..." + exit 1 + else + read -p "This script will upgrade opam to the 2.x series, are you okay with that? (y/n)" choice1 + case "$choice1" in + y|Y ) : ;; + n|N ) exit ;; + esac + fi +fi + +sudo apt-get install -y make \ + m4 \ + gcc \ + patch \ + bubblewrap \ + rsync \ + curl \ + +if [ -n "`uname -a | grep -i ubuntu`" ] +then + sudo add-apt-repository -y ppa:avsm/ppa + sudo apt-get update + sudo apt-get install opam +else + # I'm going to assume here that we're on x86_64, 32-bit users should be basically + # extinct at this point right? + curl -L https://github.com/ocaml/opam/releases/download/2.0.4/opam-2.0.4-x86_64-linux \ + --output opam_temp_version_2_0_4.bin + if [ "`openssl sha256 -r opam_temp_version_2_0_4.bin`" = "373e34f92f282273d482537f8103caad0d17b6f2699ff504bed77f474cb0c951 *opam_temp_version_2_0_4.bin" ] + then + # Stay paranoid, in case other checks fail don't want to overrwrite + # user's opam on accident + chmod +x opam_temp_version_2_0_4.bin # Set execute so we can get version + if [ -e /usr/local/bin/opam ] + then + opam_old_v=`/usr/local/bin/opam --version` + opam_new_v=`opam_temp_version_2_0_4.bin --version` + read -p "This will overrwrite the opam you have in /usr/local/bin (version $opam_old_v) with version $opam_new_v, do you actually want to do that? Type yes. (yes/n)" choice2 + else + choice2="yes" + fi + if [ $choice2 = "yes" ] + then + sudo mv opam_temp_version_2_0_4.bin /usr/local/bin/opam + else + rm opam_temp_version_2_0_4.bin + exit + fi + else + echo "opam file hash doesn't match what was recorded at time of signature verification!" + echo "(If you actually get this message, you should probably file an issue)" + echo "https://gitlab.com/ligolang/ligo/issues" + exit 1 + fi +fi + +opam init -a --bare diff --git a/scripts/setup_dev_switch.sh b/scripts/setup_dev_switch.sh new file mode 100755 index 000000000..5b9ea1dca --- /dev/null +++ b/scripts/setup_dev_switch.sh @@ -0,0 +1,4 @@ +opam switch create . ocaml-base-compiler.4.06.1 +eval $(opam env) +opam install -y ocp-indent tuareg merlin alcotest-lwt crowbar +opam -y user-setup install diff --git a/scripts/test_ligo.sh b/scripts/test_ligo.sh new file mode 100755 index 000000000..d13e26d3d --- /dev/null +++ b/scripts/test_ligo.sh @@ -0,0 +1,2 @@ +eval $(opam env) +dune build @ligo-test diff --git a/src/ligo.opam b/src/ligo.opam index 09d0861ce..a5e076696 100644 --- a/src/ligo.opam +++ b/src/ligo.opam @@ -17,6 +17,7 @@ depends: [ "proto-alpha-utils" "yojson" "alcotest" { with-test } + "getopt" ] build: [ [ "dune" "build" "-p" name "-j" jobs ] diff --git a/src/parser/camligo/dune b/src/parser/camligo/dune index c83279eed..62e28bcb6 100644 --- a/src/parser/camligo/dune +++ b/src/parser/camligo/dune @@ -21,7 +21,7 @@ (rule (targets parser.ml parser.mli) (deps parser_generated.mly ast.ml) - (action (system "menhir --explain --external-tokens Lex.Token lex/token.mly parser_generated.mly --base parser")) + (action (system "menhir --explain --unused-tokens --external-tokens Lex.Token lex/token.mly parser_generated.mly --base parser")) ) (rule diff --git a/src/parser/dune b/src/parser/dune index eb7dca130..9fa014ac7 100644 --- a/src/parser/dune +++ b/src/parser/dune @@ -4,6 +4,7 @@ (libraries simple-utils tezos-utils + parser_shared parser_pascaligo parser_camligo parser_ligodity @@ -11,5 +12,5 @@ (preprocess (pps simple-utils.ppx_let_generalized) ) - (flags (:standard -w +1..62-4-9-44-40-42-48-30@39@33 -open Simple_utils )) + (flags (:standard -w +1..62-4-9-44-40-42-48-30@39@33 -open Simple_utils -open Parser_shared )) ) diff --git a/src/parser/ligodity/dune b/src/parser/ligodity/dune index ed67c795c..1d26b826f 100644 --- a/src/parser/ligodity/dune +++ b/src/parser/ligodity/dune @@ -15,6 +15,7 @@ zarith simple-utils tezos-utils + getopt ) (flags (:standard -open Simple_utils )) ) diff --git a/src/parser/pascaligo/.links b/src/parser/pascaligo/.links index 8af33d655..1f30004d4 100644 --- a/src/parser/pascaligo/.links +++ b/src/parser/pascaligo/.links @@ -4,4 +4,18 @@ $HOME/git/ligo/vendors/ligo-utils/simple-utils/pos.mli $HOME/git/ligo/vendors/ligo-utils/simple-utils/pos.ml $HOME/git/ligo/vendors/ligo-utils/simple-utils/region.mli $HOME/git/ligo/vendors/ligo-utils/simple-utils/region.ml +$HOME/git/ligo/src/parser/shared/Lexer.mli +$HOME/git/ligo/src/parser/shared/Lexer.mll +$HOME/git/ligo/src/parser/shared/Error.mli +$HOME/git/ligo/src/parser/shared/EvalOpt.ml +$HOME/git/ligo/src/parser/shared/EvalOpt.mli +$HOME/git/ligo/src/parser/shared/FQueue.ml +$HOME/git/ligo/src/parser/shared/FQueue.mli +$HOME/git/ligo/src/parser/shared/LexerLog.mli +$HOME/git/ligo/src/parser/shared/LexerLog.ml +$HOME/git/ligo/src/parser/shared/Markup.ml +$HOME/git/ligo/src/parser/shared/Markup.mli +$HOME/git/ligo/src/parser/shared/Utils.mli +$HOME/git/ligo/src/parser/shared/Utils.ml +$HOME/git/ligo/src/parser/shared/Version.ml Stubs/Simple_utils.ml diff --git a/src/parser/pascaligo/Doc/pascaligo.txt b/src/parser/pascaligo/Doc/pascaligo.txt index 53c4d79fc..170253ae9 100644 --- a/src/parser/pascaligo/Doc/pascaligo.txt +++ b/src/parser/pascaligo/Doc/pascaligo.txt @@ -11,10 +11,6 @@ The directory contains the following: Tests The directory containing tests. - Version.ml - A source containing a commit hash. It should be deleted, as Dune - knows how to generate and updated version. - dune The Dune file for building the Pascaligo parser. @@ -46,11 +42,6 @@ The directory contains the following: build only a standalone lexer or a standalone parser. Do not change, unless you change EvalOpt and use Christian's build system. - LexerLog.ml - LexerLog.mli - Source for instantiating a standalone lexer for LexerMain.ml and - ParserMain.ml. Ignore them. - ParserLog.mli ParserLog.ml Source for printing the AST. Used by ParserMain.ml, pascaligo.ml @@ -65,51 +56,6 @@ The directory contains the following: AST.ml The abstract syntax tree of Pascaligo. - EvalOpt.mli - EvalOpt.ml - The module EvalOpt parses the command-line for options to the - parser. That action is performed as a side-effect when the module - is initialised at run-time: this is ugly and easy to fix. See - ligo/src/parser/ligodity/EvalOpt.ml{i} for the right way to do - it. Ignore them: the file actually calling directly the parser is - ligo/src/parser/parser.ml. Note that, as a consequence, no option - is currently passed to the parser when building Pascaligo with - Dune. This should be made available. - - Markup.mli - Markup.ml - The definition of markup in Pascaligo source files, and some some - functions to print or convert it to strings. You are unlikely - going to modify those files, as markup is pretty much the same for - all LIGO flavours. - - FQueue.mli - FQueue.ml - A naive implementation of purely functional queues. Replace by an - imperative implementation if worst-case performance of single - operations (queue/enqueue) is an issue. - - Error.mli - The definition of the open type for errors: the lexer will add its - own errors, the downside being that matching on errors requires a - catch-all clause "| _ -> assert false" at the end. Note: the rest - of the compiler uses an error monad. - - Lexer.mli - Lexer.mll - The Pascaligo lexer is generated from two ocamllex - specifications. Lexer.mll is the first-level lexer. It exports a - functor [Make] parameterised over a module [Token] defining the - tokens, and returning a module whose signature is [Lexer.S]. (See - Lexer.mli for a rationale.) If you write a new flavour of LIGO, - this lexer is likely to be reused as is. Note that a great deal of - the complexity of this lexer stems from its purpose to report - stylistic errors (hence keeping temporarily scanned markup) and - handling UTF-8 encoded comments. The first goal implies sometimes - reading more than one token, and an extra-buffer has to be managed - above the ocamllex one, so the parser is not confused about the - location (region) of the token it has just read. - LexToken.mli LexToken.mll The second-level lexer of Pascaligo, scanning the (lexical) diff --git a/src/parser/pascaligo/dune b/src/parser/pascaligo/dune index 170804c1a..85bebdecb 100644 --- a/src/parser/pascaligo/dune +++ b/src/parser/pascaligo/dune @@ -1,5 +1,4 @@ (ocamllex LexToken) -(ocamllex Lexer) (menhir (merge_into Parser) @@ -9,17 +8,27 @@ (library (name parser_pascaligo) (public_name ligo.parser.pascaligo) - (modules AST FQueue Markup pascaligo Utils Version Lexer Error Parser ParserLog LexToken) - (modules_without_implementation Error) + (modules AST pascaligo Parser ParserLog LexToken) (libraries - hex - str - uutf - zarith + parser_shared + hex simple-utils tezos-utils ) - (flags (:standard -open Simple_utils )) + (flags (:standard -open Parser_shared -open Simple_utils)) +) + +(executable + (name LexerMain) + (libraries + hex + simple-utils + tezos-utils + parser_pascaligo) + (modules + LexerMain + ) + (flags (:standard -open Parser_shared -open Parser_pascaligo)) ) ;; Les deux directives (rule) qui suivent sont pour le dev local. @@ -36,9 +45,3 @@ ; (deps LexerMain.exe) ; (action (copy LexerMain.exe Lexer.exe)) ; (mode promote-until-clean)) - -(rule - (targets Version.ml) - (action - (progn (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(echo UNKNOWN)\" > Version.ml"))) - (mode promote-until-clean)) diff --git a/src/parser/shared/.links b/src/parser/shared/.links new file mode 100644 index 000000000..c366f9924 --- /dev/null +++ b/src/parser/shared/.links @@ -0,0 +1,7 @@ +$HOME/git/OCaml-build/Makefile +$HOME/git/OCaml-build/Makefile.cfg +$HOME/git/ligo/vendors/ligo-utils/simple-utils/pos.mli +$HOME/git/ligo/vendors/ligo-utils/simple-utils/pos.ml +$HOME/git/ligo/vendors/ligo-utils/simple-utils/region.mli +$HOME/git/ligo/vendors/ligo-utils/simple-utils/region.ml +$HOME/git/ligo/vendors/ligo-utils/simple-utils/region.ml diff --git a/src/parser/shared/Doc/shared.txt b/src/parser/shared/Doc/shared.txt new file mode 100644 index 000000000..721bb5037 --- /dev/null +++ b/src/parser/shared/Doc/shared.txt @@ -0,0 +1,55 @@ +INTERNAL DOCUMENTATION OF THE SHARED PARSER FUNCTIONALITY + + Version.ml + A source containing a commit hash. It should be deleted, as Dune + knows how to generate and updated version. + + EvalOpt.mli + EvalOpt.ml + The module EvalOpt parses the command-line for options to the + parser. That action is performed as a side-effect when the module + is initialised at run-time: this is ugly and easy to fix. See + ligo/src/parser/ligodity/EvalOpt.ml{i} for the right way to do + it. Ignore them: the file actually calling directly the parser is + ligo/src/parser/parser.ml. Note that, as a consequence, no option + is currently passed to the parser when building Pascaligo with + Dune. This should be made available. + + Markup.mli + Markup.ml + The definition of markup in source files, and some functions to + print or convert it to strings. You are unlikely going to modify + those files, as markup is pretty much the same for all LIGO + flavours. + + FQueue.mli + FQueue.ml + A naive implementation of purely functional queues. Replace by an + imperative implementation if worst-case performance of single + operations (queue/enqueue) is an issue. + + Error.mli + The definition of the open type for errors: the lexer will add its + own errors, the downside being that matching on errors requires a + catch-all clause "| _ -> assert false" at the end. Note: the rest + of the compiler uses an error monad. + + Lexer.mli + Lexer.mll + The Pascaligo lexer is generated from two ocamllex + specifications. Lexer.mll is the first-level lexer. It exports a + functor [Make] parameterised over a module [Token] defining the + tokens, and returning a module whose signature is [Lexer.S]. (See + Lexer.mli for a rationale.) If you write a new flavour of LIGO, + this lexer is likely to be reused as is. Note that a great deal of + the complexity of this lexer stems from its purpose to report + stylistic errors (hence keeping temporarily scanned markup) and + handling UTF-8 encoded comments. The first goal implies sometimes + reading more than one token, and an extra-buffer has to be managed + above the ocamllex one, so the parser is not confused about the + location (region) of the token it has just read. + + LexerLog.ml + LexerLog.mli + Source for instantiating a standalone lexer for LexerMain.ml and + ParserMain.ml. Ignore them. \ No newline at end of file diff --git a/src/parser/pascaligo/Error.mli b/src/parser/shared/Error.mli similarity index 100% rename from src/parser/pascaligo/Error.mli rename to src/parser/shared/Error.mli diff --git a/src/parser/pascaligo/EvalOpt.ml b/src/parser/shared/EvalOpt.ml similarity index 100% rename from src/parser/pascaligo/EvalOpt.ml rename to src/parser/shared/EvalOpt.ml diff --git a/src/parser/pascaligo/EvalOpt.mli b/src/parser/shared/EvalOpt.mli similarity index 100% rename from src/parser/pascaligo/EvalOpt.mli rename to src/parser/shared/EvalOpt.mli diff --git a/src/parser/pascaligo/FQueue.ml b/src/parser/shared/FQueue.ml similarity index 100% rename from src/parser/pascaligo/FQueue.ml rename to src/parser/shared/FQueue.ml diff --git a/src/parser/pascaligo/FQueue.mli b/src/parser/shared/FQueue.mli similarity index 100% rename from src/parser/pascaligo/FQueue.mli rename to src/parser/shared/FQueue.mli diff --git a/src/parser/pascaligo/Lexer.mli b/src/parser/shared/Lexer.mli similarity index 100% rename from src/parser/pascaligo/Lexer.mli rename to src/parser/shared/Lexer.mli diff --git a/src/parser/pascaligo/Lexer.mll b/src/parser/shared/Lexer.mll similarity index 100% rename from src/parser/pascaligo/Lexer.mll rename to src/parser/shared/Lexer.mll diff --git a/src/parser/pascaligo/LexerLog.ml b/src/parser/shared/LexerLog.ml similarity index 100% rename from src/parser/pascaligo/LexerLog.ml rename to src/parser/shared/LexerLog.ml diff --git a/src/parser/pascaligo/LexerLog.mli b/src/parser/shared/LexerLog.mli similarity index 100% rename from src/parser/pascaligo/LexerLog.mli rename to src/parser/shared/LexerLog.mli diff --git a/src/parser/pascaligo/Markup.ml b/src/parser/shared/Markup.ml similarity index 100% rename from src/parser/pascaligo/Markup.ml rename to src/parser/shared/Markup.ml diff --git a/src/parser/pascaligo/Markup.mli b/src/parser/shared/Markup.mli similarity index 100% rename from src/parser/pascaligo/Markup.mli rename to src/parser/shared/Markup.mli diff --git a/src/parser/pascaligo/Utils.ml b/src/parser/shared/Utils.ml similarity index 100% rename from src/parser/pascaligo/Utils.ml rename to src/parser/shared/Utils.ml diff --git a/src/parser/pascaligo/Utils.mli b/src/parser/shared/Utils.mli similarity index 100% rename from src/parser/pascaligo/Utils.mli rename to src/parser/shared/Utils.mli diff --git a/src/parser/shared/dune b/src/parser/shared/dune new file mode 100644 index 000000000..7e62da9a8 --- /dev/null +++ b/src/parser/shared/dune @@ -0,0 +1,28 @@ +(ocamllex Lexer) + +(library + (name parser_shared) + (public_name ligo.parser.shared) + (libraries + simple-utils + uutf + getopt + ) + (modules + Error + Lexer + LexerLog + Utils + Markup + FQueue + EvalOpt + Version + ) + (modules_without_implementation Error) +) + +(rule + (targets Version.ml) + (action + (progn (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(echo UNKNOWN)\" > Version.ml"))) + (mode promote-until-clean)) \ No newline at end of file diff --git a/urls.txt b/urls.txt index e538c3e7e..610db2b98 100644 --- a/urls.txt +++ b/urls.txt @@ -1 +1 @@ -repo 604d7d8c5eb209596f929225538c2c3c 420 +repo f9ec38c6d4dfb4ef9f64edb361326b32 420