Refactoring of the dune files, minimised dependencies.
This commit is contained in:
parent
2eb16c2c56
commit
d1b7388550
@ -1,11 +1,12 @@
|
|||||||
module CST = Cst.Cameligo
|
module CST = Cst.Cameligo
|
||||||
module LexToken = Parser_cameligo.LexToken
|
module LexToken = Lexer_cameligo.LexToken
|
||||||
module Lexer = Lexer.Make(LexToken)
|
module Lexer = Lexer_shared.Lexer.Make (LexToken)
|
||||||
module Scoping = Parser_cameligo.Scoping
|
module Scoping = Parser_cameligo.Scoping
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module ParErr = Parser_cameligo.ParErr
|
module ParErr = Parser_cameligo.ParErr
|
||||||
module SSet = Set.Make (String)
|
module SSet = Set.Make (String)
|
||||||
module Pretty = Parser_cameligo.Pretty
|
module Pretty = Parser_cameligo.Pretty
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
|
||||||
(* Mock IOs TODO: Fill them with CLI options *)
|
(* Mock IOs TODO: Fill them with CLI options *)
|
||||||
|
|
||||||
|
@ -5,17 +5,24 @@ $HOME/git/OCaml-build/Makefile
|
|||||||
../shared/LexerLib.ml
|
../shared/LexerLib.ml
|
||||||
../shared/EvalOpt.ml
|
../shared/EvalOpt.ml
|
||||||
../shared/EvalOpt.mli
|
../shared/EvalOpt.mli
|
||||||
../shared/FQueue.ml
|
|
||||||
../shared/FQueue.mli
|
|
||||||
../shared/LexerLog.mli
|
../shared/LexerLog.mli
|
||||||
../shared/LexerLog.ml
|
../shared/LexerLog.ml
|
||||||
../shared/Markup.ml
|
../shared/Markup.ml
|
||||||
../shared/Markup.mli
|
../shared/Markup.mli
|
||||||
../shared/Utils.mli
|
|
||||||
../shared/Utils.ml
|
|
||||||
../shared/ParserAPI.mli
|
../shared/ParserAPI.mli
|
||||||
../shared/ParserAPI.ml
|
../shared/ParserAPI.ml
|
||||||
../shared/LexerUnit.mli
|
../shared/LexerUnit.mli
|
||||||
../shared/LexerUnit.ml
|
../shared/LexerUnit.ml
|
||||||
../shared/ParserUnit.mli
|
../shared/ParserUnit.mli
|
||||||
../shared/ParserUnit.ml
|
../shared/ParserUnit.ml
|
||||||
|
|
||||||
|
./Stubs/Lexer_shared.ml
|
||||||
|
./Stubs/Lexer_cameligo.ml
|
||||||
|
./Stubs/Parser_shared.ml
|
||||||
|
./Stubs/Parser_cameligo.ml
|
||||||
|
./Stubs/Cst.ml
|
||||||
|
./Stubs/Cst_cameligo.ml
|
||||||
|
|
||||||
|
$HOME/git/ligo/src/stages/1-cst/cameligo/CST.ml
|
||||||
|
$HOME/git/ligo/src/stages/1-cst/cameligo/ParserLog.mli
|
||||||
|
$HOME/git/ligo/src/stages/1-cst/cameligo/ParserLog.ml
|
||||||
|
@ -21,13 +21,16 @@
|
|||||||
aliased to [token].
|
aliased to [token].
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module Pos = Simple_utils.Pos
|
module Pos = Simple_utils.Pos
|
||||||
|
module Markup = Lexer_shared.Markup
|
||||||
type lexeme = string
|
|
||||||
|
|
||||||
(* TOKENS *)
|
(* TOKENS *)
|
||||||
|
|
||||||
|
type lexeme = string
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
(* Identifiers, labels, numbers and strings *)
|
(* Identifiers, labels, numbers and strings *)
|
||||||
|
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
|
(* ocamlex specification for CameLIGO *)
|
||||||
{
|
{
|
||||||
(* START HEADER *)
|
(* START HEADER *)
|
||||||
|
|
||||||
type lexeme = string
|
(* Dependencies *)
|
||||||
|
|
||||||
let sprintf = Printf.sprintf
|
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module Pos = Simple_utils.Pos
|
module Pos = Simple_utils.Pos
|
||||||
module SMap = Utils.String.Map
|
module Markup = Lexer_shared.Markup
|
||||||
module SSet = Utils.String.Set
|
module SMap = Map.Make (String)
|
||||||
|
module SSet = Set.Make (String)
|
||||||
|
|
||||||
(* TOKENS *)
|
(* TOKENS *)
|
||||||
|
|
||||||
|
type lexeme = string
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
(* Identifiers, labels, numbers and strings *)
|
(* Identifiers, labels, numbers and strings *)
|
||||||
|
|
||||||
@ -107,6 +109,8 @@ type t =
|
|||||||
|
|
||||||
(* Projections *)
|
(* Projections *)
|
||||||
|
|
||||||
|
let sprintf = Printf.sprintf
|
||||||
|
|
||||||
type token = t
|
type token = t
|
||||||
|
|
||||||
let proj_token = function
|
let proj_token = function
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
(* Driver for the CameLIGO lexer *)
|
(* Driver for the CameLIGO lexer *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module Lexer = Lexer_shared.Lexer
|
||||||
|
module LexerUnit = Lexer_shared.LexerUnit
|
||||||
|
module LexToken = Lexer_cameligo.LexToken
|
||||||
|
|
||||||
|
(* Input/Output *)
|
||||||
|
|
||||||
module IO =
|
module IO =
|
||||||
struct
|
struct
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
%{
|
%{
|
||||||
|
module LexToken = Lexer_cameligo.LexToken
|
||||||
%}
|
%}
|
||||||
|
|
||||||
(* Tokens (mirroring thise defined in module LexToken) *)
|
(* Tokens (mirroring thise defined in module LexToken) *)
|
||||||
|
@ -15,8 +15,8 @@ open CST
|
|||||||
(* Entry points *)
|
(* Entry points *)
|
||||||
|
|
||||||
%start contract interactive_expr
|
%start contract interactive_expr
|
||||||
%type <Cst.Cameligo.t> contract
|
%type <CST.t> contract
|
||||||
%type <Cst.Cameligo.expr> interactive_expr
|
%type <CST.expr> interactive_expr
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
(* Driver for the CameLIGO parser *)
|
(* Driver for the CameLIGO parser *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module LexToken = Lexer_cameligo.LexToken
|
||||||
|
module CST = Cst.Cameligo
|
||||||
module SSet = Set.Make (String)
|
module SSet = Set.Make (String)
|
||||||
|
module ParserUnit = Parser_shared.ParserUnit
|
||||||
|
module Pretty = Parser_cameligo.Pretty
|
||||||
|
|
||||||
|
(* Input/Output *)
|
||||||
|
|
||||||
module IO =
|
module IO =
|
||||||
struct
|
struct
|
||||||
@ -55,22 +64,22 @@ module SubIO =
|
|||||||
|
|
||||||
module Parser =
|
module Parser =
|
||||||
struct
|
struct
|
||||||
type ast = AST.t
|
type ast = CST.t
|
||||||
type expr = AST.expr
|
type expr = CST.expr
|
||||||
include Parser
|
include Parser_cameligo.Parser
|
||||||
end
|
end
|
||||||
|
|
||||||
module ParserLog =
|
module ParserLog =
|
||||||
struct
|
struct
|
||||||
type ast = AST.t
|
type ast = CST.t
|
||||||
type expr = AST.expr
|
type expr = CST.expr
|
||||||
include ParserLog
|
include Cst_cameligo.ParserLog
|
||||||
end
|
end
|
||||||
|
|
||||||
module Lexer = Lexer.Make (LexToken)
|
module Lexer = Lexer_shared.Lexer.Make (LexToken)
|
||||||
|
|
||||||
module Unit =
|
module Unit =
|
||||||
ParserUnit.Make (Lexer)(AST)(Parser)(Parser_msg)(ParserLog)(SubIO)
|
ParserUnit.Make (Lexer)(CST)(Parser)(Parser_msg)(ParserLog)(SubIO)
|
||||||
|
|
||||||
(* Main *)
|
(* Main *)
|
||||||
|
|
||||||
|
2
src/passes/01-parsing/cameligo/README.txt
Normal file
2
src/passes/01-parsing/cameligo/README.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Note: The files Scoping.mli and Scoping.ml are the destination of
|
||||||
|
symbolic links from ../reasonligo.
|
@ -1,5 +1,7 @@
|
|||||||
[@@@warning "-42"]
|
[@@@warning "-42"]
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module CST = Cst.Cameligo
|
module CST = Cst.Cameligo
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ open Region
|
|||||||
|
|
||||||
(* Useful modules *)
|
(* Useful modules *)
|
||||||
|
|
||||||
module SSet = Utils.String.Set
|
module SSet = Set.Make (String)
|
||||||
|
|
||||||
module Ord =
|
module Ord =
|
||||||
struct
|
struct
|
||||||
|
1
src/passes/01-parsing/cameligo/Stubs/Cst.ml
Normal file
1
src/passes/01-parsing/cameligo/Stubs/Cst.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module Cameligo = CST
|
1
src/passes/01-parsing/cameligo/Stubs/Cst_cameligo.ml
Normal file
1
src/passes/01-parsing/cameligo/Stubs/Cst_cameligo.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module ParserLog = ParserLog
|
1
src/passes/01-parsing/cameligo/Stubs/Lexer_cameligo.ml
Normal file
1
src/passes/01-parsing/cameligo/Stubs/Lexer_cameligo.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module LexToken = LexToken
|
6
src/passes/01-parsing/cameligo/Stubs/Lexer_shared.ml
Normal file
6
src/passes/01-parsing/cameligo/Stubs/Lexer_shared.ml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module EvalOpt = EvalOpt
|
||||||
|
module Markup = Markup
|
||||||
|
module Lexer = Lexer
|
||||||
|
module LexerUnit = LexerUnit
|
||||||
|
module LexerLog = LexerLog
|
||||||
|
module LexerLib = LexerLib
|
2
src/passes/01-parsing/cameligo/Stubs/Parser_cameligo.ml
Normal file
2
src/passes/01-parsing/cameligo/Stubs/Parser_cameligo.ml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
module Pretty = Pretty
|
||||||
|
module Parser = Parser
|
1
src/passes/01-parsing/cameligo/Stubs/Parser_shared.ml
Normal file
1
src/passes/01-parsing/cameligo/Stubs/Parser_shared.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module ParserUnit = ParserUnit
|
@ -1,3 +0,0 @@
|
|||||||
module Parser = Parser
|
|
||||||
module Lexer = Lexer
|
|
||||||
module LexToken = LexToken
|
|
@ -1,13 +1,48 @@
|
|||||||
|
;; --------------------------------------------------------------------
|
||||||
|
;; LEXING
|
||||||
|
|
||||||
;; Build of the lexer
|
;; Build of the lexer
|
||||||
|
|
||||||
(ocamllex LexToken)
|
(ocamllex LexToken)
|
||||||
|
|
||||||
|
;; Build of the lexer as a library
|
||||||
|
|
||||||
|
(library
|
||||||
|
(name lexer_cameligo)
|
||||||
|
(public_name ligo.lexer.cameligo)
|
||||||
|
(modules LexToken)
|
||||||
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
lexer_shared
|
||||||
|
;; Third party
|
||||||
|
hex)
|
||||||
|
(preprocess
|
||||||
|
(pps bisect_ppx --conditional)))
|
||||||
|
|
||||||
|
;; Build of a standalone lexer
|
||||||
|
|
||||||
|
(executable
|
||||||
|
(name LexerMain)
|
||||||
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
lexer_shared
|
||||||
|
lexer_cameligo
|
||||||
|
;; Third party
|
||||||
|
hex)
|
||||||
|
(modules LexerMain)
|
||||||
|
(preprocess
|
||||||
|
(pps bisect_ppx --conditional)))
|
||||||
|
|
||||||
|
;; --------------------------------------------------------------------
|
||||||
|
;; PARSING
|
||||||
|
|
||||||
;; Build of the parser
|
;; Build of the parser
|
||||||
|
|
||||||
(menhir
|
(menhir
|
||||||
(merge_into Parser)
|
(merge_into Parser)
|
||||||
(modules ParToken Parser)
|
(modules ParToken Parser)
|
||||||
(flags -la 1 --table --strict --explain --external-tokens LexToken))
|
(flags -la 1 --table --strict --explain
|
||||||
|
--external-tokens Lexer_cameligo.LexToken))
|
||||||
|
|
||||||
;; Build of the parser as a library
|
;; Build of the parser as a library
|
||||||
|
|
||||||
@ -15,50 +50,47 @@
|
|||||||
(name parser_cameligo)
|
(name parser_cameligo)
|
||||||
(public_name ligo.parser.cameligo)
|
(public_name ligo.parser.cameligo)
|
||||||
(modules
|
(modules
|
||||||
Scoping cameligo Parser LexToken ParErr Pretty)
|
Scoping Parser ParErr Pretty)
|
||||||
(libraries
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
lexer_cameligo
|
||||||
|
parser_shared
|
||||||
|
cst
|
||||||
|
;; Vendors
|
||||||
|
simple-utils
|
||||||
|
;; Third party
|
||||||
pprint
|
pprint
|
||||||
terminal_size
|
terminal_size
|
||||||
menhirLib
|
menhirLib
|
||||||
parser_shared
|
hex)
|
||||||
str
|
|
||||||
simple-utils
|
|
||||||
tezos-utils
|
|
||||||
cst
|
|
||||||
)
|
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional))
|
||||||
(flags (:standard -open Parser_shared -open Simple_utils)))
|
(flags (:standard -open Cst_cameligo))) ;; For CST in Parser.mli
|
||||||
|
|
||||||
;; Build of the unlexer (for covering the error states of the LR
|
;; Build of the unlexer (for covering the
|
||||||
;; automaton)
|
;; error states of the LR automaton)
|
||||||
|
|
||||||
(executable
|
(executable
|
||||||
(name Unlexer)
|
(name Unlexer)
|
||||||
(libraries str)
|
(libraries str)
|
||||||
|
(modules Unlexer)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional)))
|
||||||
(modules Unlexer))
|
|
||||||
|
|
||||||
;; Local build of a standalone lexer
|
|
||||||
|
|
||||||
(executable
|
|
||||||
(name LexerMain)
|
|
||||||
(libraries parser_cameligo)
|
|
||||||
(modules LexerMain)
|
|
||||||
(preprocess
|
|
||||||
(pps bisect_ppx --conditional))
|
|
||||||
(flags (:standard -open Parser_shared -open Parser_cameligo)))
|
|
||||||
|
|
||||||
;; Local build of a standalone parser
|
;; Local build of a standalone parser
|
||||||
|
|
||||||
(executable
|
(executable
|
||||||
(name ParserMain)
|
(name ParserMain)
|
||||||
(libraries parser_cameligo)
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
parser_shared
|
||||||
|
parser_cameligo
|
||||||
|
cst
|
||||||
|
;; Third party
|
||||||
|
hex)
|
||||||
(modules ParserMain Parser_msg)
|
(modules ParserMain Parser_msg)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional)))
|
||||||
(flags (:standard -open Simple_utils -open Parser_shared -open Parser_cameligo)))
|
|
||||||
|
|
||||||
;; Build of the covering of error states in the LR automaton
|
;; Build of the covering of error states in the LR automaton
|
||||||
|
|
||||||
@ -85,7 +117,14 @@
|
|||||||
(rule
|
(rule
|
||||||
(targets all.mligo)
|
(targets all.mligo)
|
||||||
(deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe)
|
(deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe)
|
||||||
(action (run %{script_cover} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly --ext=mligo --unlexer=./Unlexer.exe --messages=Parser.msg --dir=. --concatenate Parser.mly )))
|
(action (run %{script_cover}
|
||||||
|
--lex-tokens=LexToken.mli
|
||||||
|
--par-tokens=ParToken.mly
|
||||||
|
--ext=mligo
|
||||||
|
--unlexer=./Unlexer.exe
|
||||||
|
--messages=Parser.msg
|
||||||
|
--dir=.
|
||||||
|
--concatenate Parser.mly)))
|
||||||
|
|
||||||
;; Error messages
|
;; Error messages
|
||||||
|
|
||||||
@ -95,8 +134,7 @@
|
|||||||
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{targets}
|
(with-stdout-to %{targets}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--update-errors error.messages.checked-in
|
--update-errors error.messages.checked-in
|
||||||
--table
|
--table
|
||||||
@ -104,18 +142,14 @@
|
|||||||
--external-tokens LexToken.mli
|
--external-tokens LexToken.mli
|
||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly))))
|
||||||
)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(target error.messages.new)
|
(target error.messages.new)
|
||||||
(mode (promote (until-clean) (only *)))
|
(mode (promote (until-clean) (only *)))
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{target}
|
(with-stdout-to %{target}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--list-errors
|
--list-errors
|
||||||
--table
|
--table
|
||||||
@ -123,18 +157,13 @@
|
|||||||
--external-tokens LexToken.mli
|
--external-tokens LexToken.mli
|
||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly))))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
(name runtest)
|
(name runtest)
|
||||||
(deps error.messages error.messages.new)
|
(deps error.messages error.messages.new)
|
||||||
(action
|
(action
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--table
|
--table
|
||||||
--strict
|
--strict
|
||||||
@ -143,12 +172,7 @@
|
|||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly
|
||||||
--compare-errors error.messages.new
|
--compare-errors error.messages.new
|
||||||
--compare-errors error.messages
|
--compare-errors error.messages)))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets ParErr.ml)
|
(targets ParErr.ml)
|
||||||
@ -156,8 +180,7 @@
|
|||||||
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{targets}
|
(with-stdout-to %{targets}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--table
|
--table
|
||||||
--strict
|
--strict
|
||||||
@ -165,7 +188,4 @@
|
|||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly
|
||||||
--compile-errors error.messages.checked-in
|
--compile-errors error.messages.checked-in))))
|
||||||
)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
module CST = Cst.Pascaligo
|
module CST = Cst.Pascaligo
|
||||||
module LexToken = Parser_pascaligo.LexToken
|
module LexToken = Lexer_pascaligo.LexToken
|
||||||
module Lexer = Lexer.Make(LexToken)
|
module Lexer = Lexer_shared.Lexer.Make (LexToken)
|
||||||
module Scoping = Parser_pascaligo.Scoping
|
module Scoping = Parser_pascaligo.Scoping
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module ParErr = Parser_pascaligo.ParErr
|
module ParErr = Parser_pascaligo.ParErr
|
||||||
|
@ -6,14 +6,10 @@ $HOME/git/OCaml-build/Makefile
|
|||||||
../shared/LexerLib.ml
|
../shared/LexerLib.ml
|
||||||
../shared/EvalOpt.ml
|
../shared/EvalOpt.ml
|
||||||
../shared/EvalOpt.mli
|
../shared/EvalOpt.mli
|
||||||
../shared/FQueue.ml
|
|
||||||
../shared/FQueue.mli
|
|
||||||
../shared/LexerLog.mli
|
../shared/LexerLog.mli
|
||||||
../shared/LexerLog.ml
|
../shared/LexerLog.ml
|
||||||
../shared/Markup.ml
|
../shared/Markup.ml
|
||||||
../shared/Markup.mli
|
../shared/Markup.mli
|
||||||
../shared/Utils.mli
|
|
||||||
../shared/Utils.ml
|
|
||||||
../shared/ParserAPI.mli
|
../shared/ParserAPI.mli
|
||||||
../shared/ParserAPI.ml
|
../shared/ParserAPI.ml
|
||||||
../shared/LexerUnit.mli
|
../shared/LexerUnit.mli
|
||||||
@ -21,3 +17,14 @@ $HOME/git/OCaml-build/Makefile
|
|||||||
../shared/ParserUnit.mli
|
../shared/ParserUnit.mli
|
||||||
../shared/ParserUnit.ml
|
../shared/ParserUnit.ml
|
||||||
../shared/LexerLib.ml
|
../shared/LexerLib.ml
|
||||||
|
|
||||||
|
./Stubs/Lexer_shared.ml
|
||||||
|
./Stubs/Lexer_pascaligo.ml
|
||||||
|
./Stubs/Parser_shared.ml
|
||||||
|
./Stubs/Parser_pascaligo.ml
|
||||||
|
./Stubs/Cst.ml
|
||||||
|
./Stubs/Cst_pascaligo.ml
|
||||||
|
|
||||||
|
$HOME/git/ligo/src/stages/1-cst/pascaligo/CST.ml
|
||||||
|
$HOME/git/ligo/src/stages/1-cst/pascaligo/ParserLog.mli
|
||||||
|
$HOME/git/ligo/src/stages/1-cst/pascaligo/ParserLog.ml
|
||||||
|
@ -21,13 +21,16 @@
|
|||||||
aliased to [token].
|
aliased to [token].
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module Pos = Simple_utils.Pos
|
module Pos = Simple_utils.Pos
|
||||||
|
module Markup = Lexer_shared.Markup
|
||||||
type lexeme = string
|
|
||||||
|
|
||||||
(* TOKENS *)
|
(* TOKENS *)
|
||||||
|
|
||||||
|
type lexeme = string
|
||||||
|
|
||||||
type attribute = {
|
type attribute = {
|
||||||
header : string;
|
header : string;
|
||||||
string : lexeme Region.reg
|
string : lexeme Region.reg
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
(* Lexer specification for LIGO, to be processed by [ocamllex] *)
|
(* ocamlex specification for PascaLIGO *)
|
||||||
|
|
||||||
{
|
{
|
||||||
(* START HEADER *)
|
(* START HEADER *)
|
||||||
|
|
||||||
(* Shorthands *)
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module Pos = Simple_utils.Pos
|
module Pos = Simple_utils.Pos
|
||||||
|
module Markup = Lexer_shared.Markup
|
||||||
module SMap = Map.Make (String)
|
module SMap = Map.Make (String)
|
||||||
module SSet = Set.Make (String)
|
module SSet = Set.Make (String)
|
||||||
|
|
||||||
type lexeme = string
|
|
||||||
|
|
||||||
let sprintf = Printf.sprintf
|
|
||||||
|
|
||||||
(* TOKENS *)
|
(* TOKENS *)
|
||||||
|
|
||||||
|
type lexeme = string
|
||||||
|
|
||||||
type attribute = {
|
type attribute = {
|
||||||
header : string;
|
header : string;
|
||||||
string : lexeme Region.reg
|
string : lexeme Region.reg
|
||||||
@ -117,6 +116,8 @@ type t =
|
|||||||
|
|
||||||
(* Projections *)
|
(* Projections *)
|
||||||
|
|
||||||
|
let sprintf = Printf.sprintf
|
||||||
|
|
||||||
type token = t
|
type token = t
|
||||||
|
|
||||||
let proj_token = function
|
let proj_token = function
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
(* Driver for the PascaLIGO lexer *)
|
(* Driver for the PascaLIGO lexer *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module Lexer = Lexer_shared.Lexer
|
||||||
|
module LexerUnit = Lexer_shared.LexerUnit
|
||||||
|
module LexToken = Lexer_pascaligo.LexToken
|
||||||
|
|
||||||
|
(* Input/Output *)
|
||||||
|
|
||||||
module IO =
|
module IO =
|
||||||
struct
|
struct
|
||||||
@ -10,8 +18,12 @@ module IO =
|
|||||||
in read ~block ~line:"//" ".ligo"
|
in read ~block ~line:"//" ".ligo"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
(* Instantiating the standalone lexer *)
|
||||||
|
|
||||||
module M = LexerUnit.Make (IO) (Lexer.Make (LexToken))
|
module M = LexerUnit.Make (IO) (Lexer.Make (LexToken))
|
||||||
|
|
||||||
|
(* Tracing all tokens in the source *)
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
match M.trace () with
|
match M.trace () with
|
||||||
Stdlib.Ok () -> ()
|
Stdlib.Ok () -> ()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
%{
|
%{
|
||||||
|
module LexToken = Lexer_pascaligo.LexToken
|
||||||
%}
|
%}
|
||||||
|
|
||||||
(* Tokens (mirroring thise defined in module LexToken) *)
|
(* Tokens (mirroring thise defined in module LexToken) *)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
(* Menhir specification of the parsing of PascaLIGO *)
|
||||||
%{
|
%{
|
||||||
(* START HEADER *)
|
(* START HEADER *)
|
||||||
|
|
||||||
[@@@warning "-42"]
|
[@@@warning "-42"]
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
open Simple_utils.Region
|
open Simple_utils.Region
|
||||||
module CST = Cst.Pascaligo
|
module CST = Cst.Pascaligo
|
||||||
open CST
|
open CST
|
||||||
@ -15,8 +18,8 @@ open CST
|
|||||||
(* Entry points *)
|
(* Entry points *)
|
||||||
|
|
||||||
%start contract interactive_expr
|
%start contract interactive_expr
|
||||||
%type <Cst.Pascaligo.t> contract
|
%type <CST.t> contract
|
||||||
%type <Cst.Pascaligo.expr> interactive_expr
|
%type <CST.expr> interactive_expr
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
(* Driver for the PascaLIGO parser *)
|
(* Driver for the PascaLIGO parser *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module LexToken = Lexer_pascaligo.LexToken
|
||||||
|
module CST = Cst.Pascaligo
|
||||||
module SSet = Set.Make (String)
|
module SSet = Set.Make (String)
|
||||||
|
module ParserUnit = Parser_shared.ParserUnit
|
||||||
|
module Pretty = Parser_pascaligo.Pretty
|
||||||
|
|
||||||
|
(* Input/Output *)
|
||||||
|
|
||||||
module IO =
|
module IO =
|
||||||
struct
|
struct
|
||||||
@ -55,22 +64,22 @@ module SubIO =
|
|||||||
|
|
||||||
module Parser =
|
module Parser =
|
||||||
struct
|
struct
|
||||||
type ast = AST.t
|
type ast = CST.t
|
||||||
type expr = AST.expr
|
type expr = CST.expr
|
||||||
include Parser
|
include Parser_pascaligo.Parser
|
||||||
end
|
end
|
||||||
|
|
||||||
module ParserLog =
|
module ParserLog =
|
||||||
struct
|
struct
|
||||||
type ast = AST.t
|
type ast = CST.t
|
||||||
type expr = AST.expr
|
type expr = CST.expr
|
||||||
include ParserLog
|
include Cst_pascaligo.ParserLog
|
||||||
end
|
end
|
||||||
|
|
||||||
module Lexer = Lexer.Make (LexToken)
|
module Lexer = Lexer_shared.Lexer.Make (LexToken)
|
||||||
|
|
||||||
module Unit =
|
module Unit =
|
||||||
ParserUnit.Make (Lexer)(AST)(Parser)(Parser_msg)(ParserLog)(SubIO)
|
ParserUnit.Make (Lexer)(CST)(Parser)(Parser_msg)(ParserLog)(SubIO)
|
||||||
|
|
||||||
(* Main *)
|
(* Main *)
|
||||||
|
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
|
(* This module exports checks on scoping, called from the parser. *)
|
||||||
|
|
||||||
[@@@warning "-42"]
|
[@@@warning "-42"]
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module CST = Cst.Pascaligo
|
module CST = Cst.Pascaligo
|
||||||
|
|
||||||
|
(* Errors *)
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
Reserved_name of CST.variable
|
Reserved_name of CST.variable
|
||||||
| Duplicate_parameter of CST.variable
|
| Duplicate_parameter of CST.variable
|
||||||
@ -18,7 +24,7 @@ open Region
|
|||||||
|
|
||||||
(* Useful modules *)
|
(* Useful modules *)
|
||||||
|
|
||||||
module SSet = Utils.String.Set
|
module SSet = Set.Make (String)
|
||||||
|
|
||||||
module Ord =
|
module Ord =
|
||||||
struct
|
struct
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
(* This module exports checks on scoping, called from the parser. *)
|
(* This module exports checks on scoping, called from the parser. *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module CST = Cst.Pascaligo
|
module CST = Cst.Pascaligo
|
||||||
|
|
||||||
|
(* Errors *)
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
Reserved_name of CST.variable
|
Reserved_name of CST.variable
|
||||||
| Duplicate_parameter of CST.variable
|
| Duplicate_parameter of CST.variable
|
||||||
|
1
src/passes/01-parsing/pascaligo/Stubs/Cst.ml
Normal file
1
src/passes/01-parsing/pascaligo/Stubs/Cst.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module Pascaligo = CST
|
1
src/passes/01-parsing/pascaligo/Stubs/Cst_pascaligo.ml
Normal file
1
src/passes/01-parsing/pascaligo/Stubs/Cst_pascaligo.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module ParserLog = ParserLog
|
1
src/passes/01-parsing/pascaligo/Stubs/Lexer_pascaligo.ml
Normal file
1
src/passes/01-parsing/pascaligo/Stubs/Lexer_pascaligo.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module LexToken = LexToken
|
6
src/passes/01-parsing/pascaligo/Stubs/Lexer_shared.ml
Normal file
6
src/passes/01-parsing/pascaligo/Stubs/Lexer_shared.ml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module EvalOpt = EvalOpt
|
||||||
|
module Markup = Markup
|
||||||
|
module Lexer = Lexer
|
||||||
|
module LexerUnit = LexerUnit
|
||||||
|
module LexerLog = LexerLog
|
||||||
|
module LexerLib = LexerLib
|
@ -0,0 +1,2 @@
|
|||||||
|
module Pretty = Pretty
|
||||||
|
module Parser = Parser
|
1
src/passes/01-parsing/pascaligo/Stubs/Parser_shared.ml
Normal file
1
src/passes/01-parsing/pascaligo/Stubs/Parser_shared.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module ParserUnit = ParserUnit
|
@ -1,13 +1,48 @@
|
|||||||
|
;; --------------------------------------------------------------------
|
||||||
|
;; LEXING
|
||||||
|
|
||||||
;; Build of the lexer
|
;; Build of the lexer
|
||||||
|
|
||||||
(ocamllex LexToken)
|
(ocamllex LexToken)
|
||||||
|
|
||||||
|
;; Build of the lexer as a library
|
||||||
|
|
||||||
|
(library
|
||||||
|
(name lexer_pascaligo)
|
||||||
|
(public_name ligo.lexer.pascaligo)
|
||||||
|
(modules LexToken)
|
||||||
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
lexer_shared
|
||||||
|
;; Third party
|
||||||
|
hex)
|
||||||
|
(preprocess
|
||||||
|
(pps bisect_ppx --conditional)))
|
||||||
|
|
||||||
|
;; Build of a standalone lexer
|
||||||
|
|
||||||
|
(executable
|
||||||
|
(name LexerMain)
|
||||||
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
lexer_shared
|
||||||
|
lexer_pascaligo
|
||||||
|
;; Third party
|
||||||
|
hex)
|
||||||
|
(modules LexerMain)
|
||||||
|
(preprocess
|
||||||
|
(pps bisect_ppx --conditional)))
|
||||||
|
|
||||||
|
;; --------------------------------------------------------------------
|
||||||
|
;; PARSING
|
||||||
|
|
||||||
;; Build of the parser
|
;; Build of the parser
|
||||||
|
|
||||||
(menhir
|
(menhir
|
||||||
(merge_into Parser)
|
(merge_into Parser)
|
||||||
(modules ParToken Parser)
|
(modules ParToken Parser)
|
||||||
(flags -la 1 --table --strict --explain --external-tokens LexToken))
|
(flags -la 1 --table --strict --explain
|
||||||
|
--external-tokens Lexer_pascaligo.LexToken))
|
||||||
|
|
||||||
;; Build of the parser as a library
|
;; Build of the parser as a library
|
||||||
|
|
||||||
@ -15,19 +50,22 @@
|
|||||||
(name parser_pascaligo)
|
(name parser_pascaligo)
|
||||||
(public_name ligo.parser.pascaligo)
|
(public_name ligo.parser.pascaligo)
|
||||||
(modules
|
(modules
|
||||||
Scoping pascaligo Parser LexToken ParErr Pretty)
|
Scoping Parser ParErr Pretty)
|
||||||
(libraries
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
lexer_pascaligo
|
||||||
|
parser_shared
|
||||||
|
cst
|
||||||
|
;; Vendors
|
||||||
|
simple-utils
|
||||||
|
;; Third party
|
||||||
pprint
|
pprint
|
||||||
terminal_size
|
terminal_size
|
||||||
menhirLib
|
menhirLib
|
||||||
parser_shared
|
hex)
|
||||||
hex
|
|
||||||
Preprocessor
|
|
||||||
simple-utils
|
|
||||||
cst)
|
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional))
|
||||||
(flags (:standard -open Parser_shared -open Simple_utils)))
|
(flags (:standard -open Cst_pascaligo))) ;; For CST in Parser.mli
|
||||||
|
|
||||||
;; Build of the unlexer (for covering the
|
;; Build of the unlexer (for covering the
|
||||||
;; error states of the LR automaton)
|
;; error states of the LR automaton)
|
||||||
@ -35,30 +73,24 @@
|
|||||||
(executable
|
(executable
|
||||||
(name Unlexer)
|
(name Unlexer)
|
||||||
(libraries str)
|
(libraries str)
|
||||||
|
(modules Unlexer)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional)))
|
||||||
(modules Unlexer))
|
|
||||||
|
|
||||||
;; Local build of a standalone lexer
|
|
||||||
|
|
||||||
(executable
|
|
||||||
(name LexerMain)
|
|
||||||
(libraries
|
|
||||||
hex simple-utils tezos-utils parser_pascaligo)
|
|
||||||
(modules LexerMain)
|
|
||||||
(preprocess
|
|
||||||
(pps bisect_ppx --conditional))
|
|
||||||
(flags (:standard -open Parser_shared -open Parser_pascaligo)))
|
|
||||||
|
|
||||||
;; Local build of a standalone parser
|
;; Local build of a standalone parser
|
||||||
|
|
||||||
(executable
|
(executable
|
||||||
(name ParserMain)
|
(name ParserMain)
|
||||||
(libraries parser_pascaligo)
|
(libraries
|
||||||
(modules ParserMain)
|
;; Ligo
|
||||||
|
parser_shared
|
||||||
|
parser_pascaligo
|
||||||
|
cst
|
||||||
|
;; Third party
|
||||||
|
hex)
|
||||||
|
(modules ParserMain Parser_msg)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional)))
|
||||||
(flags (:standard -open Simple_utils -open Parser_shared -open Parser_pascaligo)))
|
|
||||||
|
|
||||||
;; Build of the covering of error states in the LR automaton
|
;; Build of the covering of error states in the LR automaton
|
||||||
|
|
||||||
@ -85,7 +117,14 @@
|
|||||||
(rule
|
(rule
|
||||||
(targets all.ligo)
|
(targets all.ligo)
|
||||||
(deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe)
|
(deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe)
|
||||||
(action (run %{script_cover} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly --ext=ligo --unlexer=./Unlexer.exe --messages=Parser.msg --dir=. --concatenate Parser.mly)))
|
(action (run %{script_cover}
|
||||||
|
--lex-tokens=LexToken.mli
|
||||||
|
--par-tokens=ParToken.mly
|
||||||
|
--ext=ligo
|
||||||
|
--unlexer=./Unlexer.exe
|
||||||
|
--messages=Parser.msg
|
||||||
|
--dir=.
|
||||||
|
--concatenate Parser.mly)))
|
||||||
|
|
||||||
;; Error messages
|
;; Error messages
|
||||||
|
|
||||||
@ -95,8 +134,7 @@
|
|||||||
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{targets}
|
(with-stdout-to %{targets}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--update-errors error.messages.checked-in
|
--update-errors error.messages.checked-in
|
||||||
--table
|
--table
|
||||||
@ -104,18 +142,14 @@
|
|||||||
--external-tokens LexToken.mli
|
--external-tokens LexToken.mli
|
||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly))))
|
||||||
)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(target error.messages.new)
|
(target error.messages.new)
|
||||||
(mode (promote (until-clean) (only *)))
|
(mode (promote (until-clean) (only *)))
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{target}
|
(with-stdout-to %{target}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--list-errors
|
--list-errors
|
||||||
--table
|
--table
|
||||||
@ -123,18 +157,13 @@
|
|||||||
--external-tokens LexToken.mli
|
--external-tokens LexToken.mli
|
||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly))))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
(name runtest)
|
(name runtest)
|
||||||
(deps error.messages error.messages.new)
|
(deps error.messages error.messages.new)
|
||||||
(action
|
(action
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--table
|
--table
|
||||||
--strict
|
--strict
|
||||||
@ -143,10 +172,7 @@
|
|||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly
|
||||||
--compare-errors error.messages.new
|
--compare-errors error.messages.new
|
||||||
--compare-errors error.messages
|
--compare-errors error.messages)))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets ParErr.ml)
|
(targets ParErr.ml)
|
||||||
@ -154,8 +180,7 @@
|
|||||||
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{targets}
|
(with-stdout-to %{targets}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--table
|
--table
|
||||||
--strict
|
--strict
|
||||||
@ -163,7 +188,4 @@
|
|||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly
|
||||||
--compile-errors error.messages.checked-in
|
--compile-errors error.messages.checked-in))))
|
||||||
)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
module Lexer = Lexer
|
|
||||||
module LexToken = LexToken
|
|
||||||
module Parser = Parser
|
|
@ -1,12 +1,13 @@
|
|||||||
module CST = Cst.Cameligo
|
module CST = Cst.Cameligo
|
||||||
module LexToken = Parser_reasonligo.LexToken
|
module LexToken = Lexer_reasonligo.LexToken
|
||||||
module Lexer = Lexer.Make (LexToken)
|
module Lexer = Lexer_shared.Lexer.Make (LexToken)
|
||||||
module Scoping = Parser_cameligo.Scoping
|
module Scoping = Parser_cameligo.Scoping
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module ParErr = Parser_reasonligo.ParErr
|
module ParErr = Parser_reasonligo.ParErr
|
||||||
module SyntaxError = Parser_reasonligo.SyntaxError
|
module SyntaxError = Parser_reasonligo.SyntaxError
|
||||||
module SSet = Set.Make (String)
|
module SSet = Set.Make (String)
|
||||||
module Pretty = Parser_reasonligo.Pretty
|
module Pretty = Parser_reasonligo.Pretty
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
|
||||||
(* Mock IOs TODO: Fill them with CLI options *)
|
(* Mock IOs TODO: Fill them with CLI options *)
|
||||||
|
|
||||||
|
@ -5,14 +5,10 @@ $HOME/git/OCaml-build/Makefile
|
|||||||
../shared/LexerLib.ml
|
../shared/LexerLib.ml
|
||||||
../shared/EvalOpt.ml
|
../shared/EvalOpt.ml
|
||||||
../shared/EvalOpt.mli
|
../shared/EvalOpt.mli
|
||||||
../shared/FQueue.ml
|
|
||||||
../shared/FQueue.mli
|
|
||||||
../shared/LexerLog.mli
|
../shared/LexerLog.mli
|
||||||
../shared/LexerLog.ml
|
../shared/LexerLog.ml
|
||||||
../shared/Markup.ml
|
../shared/Markup.ml
|
||||||
../shared/Markup.mli
|
../shared/Markup.mli
|
||||||
../shared/Utils.mli
|
|
||||||
../shared/Utils.ml
|
|
||||||
../shared/ParserAPI.mli
|
../shared/ParserAPI.mli
|
||||||
../shared/ParserAPI.ml
|
../shared/ParserAPI.ml
|
||||||
../shared/LexerUnit.mli
|
../shared/LexerUnit.mli
|
||||||
@ -20,10 +16,13 @@ $HOME/git/OCaml-build/Makefile
|
|||||||
../shared/ParserUnit.mli
|
../shared/ParserUnit.mli
|
||||||
../shared/ParserUnit.ml
|
../shared/ParserUnit.ml
|
||||||
|
|
||||||
Stubs/Parser_cameligo.ml
|
./Stubs/Lexer_shared.ml
|
||||||
|
./Stubs/Lexer_reasonligo.ml
|
||||||
|
./Stubs/Parser_shared.ml
|
||||||
|
./Stubs/Parser_reasonligo.ml
|
||||||
|
./Stubs/Cst.ml
|
||||||
|
./Stubs/Cst_cameligo.ml
|
||||||
|
|
||||||
../cameligo/AST.ml
|
$HOME/git/ligo/src/stages/1-cst/cameligo/CST.ml
|
||||||
../cameligo/ParserLog.mli
|
$HOME/git/ligo/src/stages/1-cst/cameligo/ParserLog.mli
|
||||||
../cameligo/ParserLog.ml
|
$HOME/git/ligo/src/stages/1-cst/cameligo/ParserLog.ml
|
||||||
../cameligo/Scoping.mli
|
|
||||||
../cameligo/Scoping.ml
|
|
||||||
|
@ -21,13 +21,16 @@
|
|||||||
aliased to [token].
|
aliased to [token].
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module Pos = Simple_utils.Pos
|
module Pos = Simple_utils.Pos
|
||||||
|
module Markup = Lexer_shared.Markup
|
||||||
type lexeme = string
|
|
||||||
|
|
||||||
(* TOKENS *)
|
(* TOKENS *)
|
||||||
|
|
||||||
|
type lexeme = string
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
(* Identifiers, labels, numbers and strings *)
|
(* Identifiers, labels, numbers and strings *)
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
|
(* ocamlex specification for ReasonLIGO *)
|
||||||
{
|
{
|
||||||
(* START OF HEADER *)
|
(* START OF HEADER *)
|
||||||
|
|
||||||
(* Shorthands *)
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module Pos = Simple_utils.Pos
|
module Pos = Simple_utils.Pos
|
||||||
module SMap = Utils.String.Map
|
module Markup = Lexer_shared.Markup
|
||||||
module SSet = Utils.String.Set
|
module SMap = Map.Make (String)
|
||||||
|
module SSet = Set.Make (String)
|
||||||
type lexeme = string
|
|
||||||
|
|
||||||
let sprintf = Printf.sprintf
|
|
||||||
|
|
||||||
(* TOKENS *)
|
(* TOKENS *)
|
||||||
|
|
||||||
|
type lexeme = string
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
(* Identifiers, labels, numbers and strings *)
|
(* Identifiers, labels, numbers and strings *)
|
||||||
|
|
||||||
@ -103,6 +103,8 @@ type t =
|
|||||||
|
|
||||||
(* Projections *)
|
(* Projections *)
|
||||||
|
|
||||||
|
let sprintf = Printf.sprintf
|
||||||
|
|
||||||
type token = t
|
type token = t
|
||||||
|
|
||||||
let proj_token = function
|
let proj_token = function
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
(* Driver for the ReasonLIGO lexer *)
|
(* Driver for the ReasonLIGO lexer *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module Lexer = Lexer_shared.Lexer
|
||||||
|
module LexerUnit = Lexer_shared.LexerUnit
|
||||||
|
module LexToken = Lexer_reasonligo.LexToken
|
||||||
|
|
||||||
|
(* Input/Output *)
|
||||||
|
|
||||||
module IO =
|
module IO =
|
||||||
struct
|
struct
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
%{
|
%{
|
||||||
|
module LexToken = Lexer_reasonligo.LexToken
|
||||||
%}
|
%}
|
||||||
|
|
||||||
(* Tokens (mirroring those defined in module LexToken) *)
|
(* Tokens (mirroring those defined in module LexToken) *)
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
(* Driver for the ReasonLIGO parser *)
|
(* Driver for the ReasonLIGO parser *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module LexToken = Lexer_reasonligo.LexToken
|
||||||
|
module CST = Cst.Cameligo
|
||||||
module SSet = Set.Make (String)
|
module SSet = Set.Make (String)
|
||||||
|
module ParserUnit = Parser_shared.ParserUnit
|
||||||
|
module Pretty = Parser_reasonligo.Pretty
|
||||||
|
|
||||||
|
(* Input/Output *)
|
||||||
|
|
||||||
module IO =
|
module IO =
|
||||||
struct
|
struct
|
||||||
@ -55,22 +64,22 @@ module SubIO =
|
|||||||
|
|
||||||
module Parser =
|
module Parser =
|
||||||
struct
|
struct
|
||||||
type ast = AST.t
|
type ast = CST.t
|
||||||
type expr = AST.expr
|
type expr = CST.expr
|
||||||
include Parser
|
include Parser_reasonligo.Parser
|
||||||
end
|
end
|
||||||
|
|
||||||
module ParserLog =
|
module ParserLog =
|
||||||
struct
|
struct
|
||||||
type ast = AST.t
|
type ast = CST.t
|
||||||
type expr = AST.expr
|
type expr = CST.expr
|
||||||
include ParserLog
|
include Cst_cameligo.ParserLog
|
||||||
end
|
end
|
||||||
|
|
||||||
module Lexer = Lexer.Make (LexToken)
|
module Lexer = Lexer_shared.Lexer.Make (LexToken)
|
||||||
|
|
||||||
module Unit =
|
module Unit =
|
||||||
ParserUnit.Make (Lexer)(AST)(Parser)(Parser_msg)(ParserLog)(SubIO)
|
ParserUnit.Make (Lexer)(CST)(Parser)(Parser_msg)(ParserLog)(SubIO)
|
||||||
|
|
||||||
(* Main *)
|
(* Main *)
|
||||||
|
|
||||||
|
1
src/passes/01-parsing/reasonligo/Scoping.ml
Symbolic link
1
src/passes/01-parsing/reasonligo/Scoping.ml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../cameligo/Scoping.ml
|
1
src/passes/01-parsing/reasonligo/Scoping.mli
Symbolic link
1
src/passes/01-parsing/reasonligo/Scoping.mli
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../cameligo/Scoping.mli
|
1
src/passes/01-parsing/reasonligo/Stubs/Cst.ml
Normal file
1
src/passes/01-parsing/reasonligo/Stubs/Cst.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module Cameligo = CST
|
1
src/passes/01-parsing/reasonligo/Stubs/Cst_cameligo.ml
Normal file
1
src/passes/01-parsing/reasonligo/Stubs/Cst_cameligo.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module ParserLog = ParserLog
|
@ -0,0 +1 @@
|
|||||||
|
module LexToken = LexToken
|
6
src/passes/01-parsing/reasonligo/Stubs/Lexer_shared.ml
Normal file
6
src/passes/01-parsing/reasonligo/Stubs/Lexer_shared.ml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module EvalOpt = EvalOpt
|
||||||
|
module Markup = Markup
|
||||||
|
module Lexer = Lexer
|
||||||
|
module LexerUnit = LexerUnit
|
||||||
|
module LexerLog = LexerLog
|
||||||
|
module LexerLib = LexerLib
|
@ -1 +0,0 @@
|
|||||||
module AST = AST
|
|
@ -0,0 +1,2 @@
|
|||||||
|
module Pretty = Pretty
|
||||||
|
module Parser = Parser
|
1
src/passes/01-parsing/reasonligo/Stubs/Parser_shared.ml
Normal file
1
src/passes/01-parsing/reasonligo/Stubs/Parser_shared.ml
Normal file
@ -0,0 +1 @@
|
|||||||
|
module ParserUnit = ParserUnit
|
@ -1,13 +1,48 @@
|
|||||||
|
;; --------------------------------------------------------------------
|
||||||
|
;; LEXING
|
||||||
|
|
||||||
;; Build of the lexer
|
;; Build of the lexer
|
||||||
|
|
||||||
(ocamllex LexToken)
|
(ocamllex LexToken)
|
||||||
|
|
||||||
|
;; Build of the lexer as a library
|
||||||
|
|
||||||
|
(library
|
||||||
|
(name lexer_reasonligo)
|
||||||
|
(public_name ligo.lexer.reasonligo)
|
||||||
|
(modules LexToken)
|
||||||
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
lexer_shared
|
||||||
|
;; Third party
|
||||||
|
hex)
|
||||||
|
(preprocess
|
||||||
|
(pps bisect_ppx --conditional)))
|
||||||
|
|
||||||
|
;; Build of a standalone lexer
|
||||||
|
|
||||||
|
(executable
|
||||||
|
(name LexerMain)
|
||||||
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
lexer_shared
|
||||||
|
lexer_reasonligo
|
||||||
|
;; Third party
|
||||||
|
hex)
|
||||||
|
(modules LexerMain)
|
||||||
|
(preprocess
|
||||||
|
(pps bisect_ppx --conditional)))
|
||||||
|
|
||||||
|
;; --------------------------------------------------------------------
|
||||||
|
;; PARSING
|
||||||
|
|
||||||
;; Build of the parser
|
;; Build of the parser
|
||||||
|
|
||||||
(menhir
|
(menhir
|
||||||
(merge_into Parser)
|
(merge_into Parser)
|
||||||
(modules ParToken Parser)
|
(modules ParToken Parser)
|
||||||
(flags -la 1 --table --strict --explain --external-tokens LexToken))
|
(flags -la 1 --table --strict --explain
|
||||||
|
--external-tokens Lexer_reasonligo.LexToken))
|
||||||
|
|
||||||
;; Build of the parser as a library
|
;; Build of the parser as a library
|
||||||
|
|
||||||
@ -15,16 +50,22 @@
|
|||||||
(name parser_reasonligo)
|
(name parser_reasonligo)
|
||||||
(public_name ligo.parser.reasonligo)
|
(public_name ligo.parser.reasonligo)
|
||||||
(modules
|
(modules
|
||||||
SyntaxError reasonligo LexToken ParErr Parser Pretty)
|
SyntaxError Scoping Parser ParErr Pretty)
|
||||||
(libraries
|
(libraries
|
||||||
menhirLib
|
;; Ligo
|
||||||
|
lexer_reasonligo
|
||||||
parser_shared
|
parser_shared
|
||||||
parser_cameligo
|
cst
|
||||||
str
|
;; Vendors
|
||||||
simple-utils)
|
simple-utils
|
||||||
|
;; Third party
|
||||||
|
pprint
|
||||||
|
terminal_size
|
||||||
|
menhirLib
|
||||||
|
hex)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional))
|
||||||
(flags (:standard -open Parser_shared -open Simple_utils -open Parser_cameligo)))
|
(flags (:standard -open Cst_cameligo))) ;; For CST in Parser.mli
|
||||||
|
|
||||||
;; Build of the unlexer (for covering the
|
;; Build of the unlexer (for covering the
|
||||||
;; error states of the LR automaton)
|
;; error states of the LR automaton)
|
||||||
@ -32,31 +73,24 @@
|
|||||||
(executable
|
(executable
|
||||||
(name Unlexer)
|
(name Unlexer)
|
||||||
(libraries str)
|
(libraries str)
|
||||||
|
(modules Unlexer)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional)))
|
||||||
(modules Unlexer))
|
|
||||||
|
|
||||||
;; Local build of a standalone lexer
|
|
||||||
|
|
||||||
(executable
|
|
||||||
(name LexerMain)
|
|
||||||
(libraries parser_reasonligo)
|
|
||||||
(modules LexerMain)
|
|
||||||
(preprocess
|
|
||||||
(pps bisect_ppx --conditional))
|
|
||||||
(flags (:standard -open Parser_shared -open Parser_reasonligo)))
|
|
||||||
|
|
||||||
;; Local build of a standalone parser
|
;; Local build of a standalone parser
|
||||||
|
|
||||||
(executable
|
(executable
|
||||||
(name ParserMain)
|
(name ParserMain)
|
||||||
(libraries
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
parser_shared
|
||||||
parser_reasonligo
|
parser_reasonligo
|
||||||
parser_cameligo)
|
cst
|
||||||
(modules ParserMain)
|
;; Third party
|
||||||
|
hex)
|
||||||
|
(modules ParserMain Parser_msg)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional))
|
(pps bisect_ppx --conditional)))
|
||||||
(flags (:standard -open Simple_utils -open Parser_cameligo -open Parser_shared -open Parser_reasonligo)))
|
|
||||||
|
|
||||||
;; Build of the covering of error states in the LR automaton
|
;; Build of the covering of error states in the LR automaton
|
||||||
|
|
||||||
@ -83,7 +117,16 @@
|
|||||||
(rule
|
(rule
|
||||||
(targets all.religo)
|
(targets all.religo)
|
||||||
(deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe)
|
(deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe)
|
||||||
(action (run %{script_cover} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly --ext=religo --unlexer=./Unlexer.exe --messages=Parser.msg --dir=. --concatenate Parser.mly )))
|
(action (run %{script_cover}
|
||||||
|
--lex-tokens=LexToken.mli
|
||||||
|
--par-tokens=ParToken.mly
|
||||||
|
--ext=religo
|
||||||
|
--unlexer=./Unlexer.exe
|
||||||
|
--messages=Parser.msg
|
||||||
|
--dir=.
|
||||||
|
--concatenate Parser.mly)))
|
||||||
|
|
||||||
|
;; Error messages
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets error.messages)
|
(targets error.messages)
|
||||||
@ -91,8 +134,7 @@
|
|||||||
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{targets}
|
(with-stdout-to %{targets}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--update-errors error.messages.checked-in
|
--update-errors error.messages.checked-in
|
||||||
--table
|
--table
|
||||||
@ -100,18 +142,14 @@
|
|||||||
--external-tokens LexToken.mli
|
--external-tokens LexToken.mli
|
||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly))))
|
||||||
)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(target error.messages.new)
|
(target error.messages.new)
|
||||||
(mode (promote (until-clean) (only *)))
|
(mode (promote (until-clean) (only *)))
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{target}
|
(with-stdout-to %{target}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--list-errors
|
--list-errors
|
||||||
--table
|
--table
|
||||||
@ -119,18 +157,13 @@
|
|||||||
--external-tokens LexToken.mli
|
--external-tokens LexToken.mli
|
||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly))))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
(name runtest)
|
(name runtest)
|
||||||
(deps error.messages error.messages.new)
|
(deps error.messages error.messages.new)
|
||||||
(action
|
(action
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--table
|
--table
|
||||||
--strict
|
--strict
|
||||||
@ -139,12 +172,7 @@
|
|||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly
|
||||||
--compare-errors error.messages.new
|
--compare-errors error.messages.new
|
||||||
--compare-errors error.messages
|
--compare-errors error.messages)))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets ParErr.ml)
|
(targets ParErr.ml)
|
||||||
@ -152,8 +180,7 @@
|
|||||||
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
||||||
(action
|
(action
|
||||||
(with-stdout-to %{targets}
|
(with-stdout-to %{targets}
|
||||||
(run
|
(run menhir
|
||||||
menhir
|
|
||||||
--unused-tokens
|
--unused-tokens
|
||||||
--table
|
--table
|
||||||
--strict
|
--strict
|
||||||
@ -161,7 +188,4 @@
|
|||||||
--base Parser.mly
|
--base Parser.mly
|
||||||
ParToken.mly
|
ParToken.mly
|
||||||
Parser.mly
|
Parser.mly
|
||||||
--compile-errors error.messages.checked-in
|
--compile-errors error.messages.checked-in))))
|
||||||
)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
module Parser = Parser
|
|
||||||
module Lexer = Lexer
|
|
||||||
module LexToken = LexToken
|
|
||||||
module SyntaxError = SyntaxError
|
|
@ -1,5 +1,8 @@
|
|||||||
|
(* A library for writing UTF8-aware lexers *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module Pos = Simple_utils.Pos
|
module Pos = Simple_utils.Pos
|
||||||
|
module FQueue = Simple_utils.FQueue
|
||||||
|
|
||||||
(* LEXER ENGINE *)
|
(* LEXER ENGINE *)
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
module Pos = Simple_utils.Pos
|
module Pos = Simple_utils.Pos
|
||||||
|
module FQueue = Simple_utils.FQueue
|
||||||
|
|
||||||
(* The function [rollback] resets the lexing buffer to the state it
|
(* The function [rollback] resets the lexing buffer to the state it
|
||||||
was when it matched the last regular expression. This function is
|
was when it matched the last regular expression. This function is
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
(* Generic parser for LIGO *)
|
(* Generic parser for LIGO *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module Lexer = Lexer_shared.Lexer
|
||||||
|
module LexerLib = Lexer_shared.LexerLib
|
||||||
|
module LexerLog = Lexer_shared.LexerLog
|
||||||
|
|
||||||
|
(* Input/Output *)
|
||||||
|
|
||||||
type options = <
|
type options = <
|
||||||
offsets : bool;
|
offsets : bool;
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
(* Generic parser API for LIGO *)
|
(* Generic parser API for LIGO *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module Lexer = Lexer_shared.Lexer
|
||||||
|
module LexerLib = Lexer_shared.LexerLib
|
||||||
|
|
||||||
|
(* Input/Output *)
|
||||||
|
|
||||||
type options = <
|
type options = <
|
||||||
offsets : bool;
|
offsets : bool;
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
(* Functor to build a LIGO parser *)
|
(* Functor to build a LIGO parser *)
|
||||||
|
|
||||||
|
(* Dependencies *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module Lexer = Lexer_shared.Lexer
|
||||||
|
module LexerLib = Lexer_shared.LexerLib
|
||||||
|
module LexerLog = Lexer_shared.LexerLog
|
||||||
module Preproc = Preprocessor.Preproc
|
module Preproc = Preprocessor.Preproc
|
||||||
module SSet = Set.Make (String)
|
module SSet = Set.Make (String)
|
||||||
|
|
||||||
|
(* A subtype of [EvalOpt.options] *)
|
||||||
|
|
||||||
module type SubIO =
|
module type SubIO =
|
||||||
sig
|
sig
|
||||||
type options = <
|
type options = <
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
(* Functor to build a standalone LIGO parser *)
|
(* Functor to build a standalone LIGO parser *)
|
||||||
|
|
||||||
module Region = Simple_utils.Region
|
(* Dependencies *)
|
||||||
|
|
||||||
module SSet : Set.S with type elt = string and type t = Set.Make(String).t
|
module Region = Simple_utils.Region
|
||||||
|
module EvalOpt = Lexer_shared.EvalOpt
|
||||||
|
module Lexer = Lexer_shared.Lexer
|
||||||
|
module SSet : Set.S with type elt = string
|
||||||
|
and type t = Set.Make(String).t
|
||||||
|
|
||||||
(* A subtype of [EvalOpt.options] *)
|
(* A subtype of [EvalOpt.options] *)
|
||||||
|
|
||||||
|
@ -1,29 +1,51 @@
|
|||||||
|
;; Build of the lexer in common to all Ligo's dialects
|
||||||
|
|
||||||
(ocamllex Lexer)
|
(ocamllex Lexer)
|
||||||
|
|
||||||
|
;; Build of the lexer as a library
|
||||||
|
|
||||||
|
(library
|
||||||
|
(name lexer_shared)
|
||||||
|
(public_name ligo.lexer.shared)
|
||||||
|
(libraries
|
||||||
|
;; Ligo
|
||||||
|
simple-utils
|
||||||
|
;; Vendors
|
||||||
|
Preprocessor
|
||||||
|
;; Third party
|
||||||
|
uutf
|
||||||
|
getopt
|
||||||
|
zarith)
|
||||||
|
(modules
|
||||||
|
LexerLib
|
||||||
|
LexerUnit
|
||||||
|
Lexer
|
||||||
|
LexerLog
|
||||||
|
Markup
|
||||||
|
EvalOpt
|
||||||
|
Version)
|
||||||
|
(preprocess
|
||||||
|
(pps bisect_ppx --conditional)))
|
||||||
|
|
||||||
|
;; Build of the parser as a library
|
||||||
|
|
||||||
(library
|
(library
|
||||||
(name parser_shared)
|
(name parser_shared)
|
||||||
(public_name ligo.parser.shared)
|
(public_name ligo.parser.shared)
|
||||||
(libraries
|
(libraries
|
||||||
menhirLib
|
;; Ligo
|
||||||
|
lexer_shared
|
||||||
simple-utils
|
simple-utils
|
||||||
uutf
|
;; Third party
|
||||||
getopt
|
menhirLib)
|
||||||
zarith
|
|
||||||
Preprocessor)
|
|
||||||
(preprocess
|
|
||||||
(pps bisect_ppx --conditional))
|
|
||||||
(modules
|
(modules
|
||||||
LexerLib
|
|
||||||
LexerUnit
|
|
||||||
ParserUnit
|
ParserUnit
|
||||||
ParserAPI
|
ParserAPI)
|
||||||
Lexer
|
(preprocess
|
||||||
LexerLog
|
(pps bisect_ppx --conditional)))
|
||||||
Markup
|
;; (flags (:standard -open Lexer_shared)))
|
||||||
Utils
|
|
||||||
FQueue
|
;; Build of the version source (for the user, as a CLI option)
|
||||||
EvalOpt
|
|
||||||
Version))
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Version.ml)
|
(targets Version.ml)
|
||||||
|
@ -15,7 +15,7 @@ type abs_error = [
|
|||||||
| `Concrete_pascaligo_unsupported_string_singleton of Raw.type_expr
|
| `Concrete_pascaligo_unsupported_string_singleton of Raw.type_expr
|
||||||
| `Concrete_pascaligo_unsupported_deep_some_pattern of Raw.pattern
|
| `Concrete_pascaligo_unsupported_deep_some_pattern of Raw.pattern
|
||||||
| `Concrete_pascaligo_unsupported_deep_list_pattern of Raw.pattern
|
| `Concrete_pascaligo_unsupported_deep_list_pattern of Raw.pattern
|
||||||
| `Concrete_pascaligo_unsupported_deep_tuple_pattern of (Raw.pattern, Raw.wild) Parser_shared.Utils.nsepseq Raw.par Raw.reg
|
| `Concrete_pascaligo_unsupported_deep_tuple_pattern of (Raw.pattern, Raw.wild) Simple_utils.Utils.nsepseq Raw.par Raw.reg
|
||||||
| `Concrete_pascaligo_unknown_built_in of string
|
| `Concrete_pascaligo_unknown_built_in of string
|
||||||
| `Concrete_pascaligo_michelson_type_wrong of Raw.type_expr * string
|
| `Concrete_pascaligo_michelson_type_wrong of Raw.type_expr * string
|
||||||
| `Concrete_pascaligo_michelson_type_wrong_arity of Location.t * string
|
| `Concrete_pascaligo_michelson_type_wrong_arity of Location.t * string
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
(* Utilities *)
|
(* Utilities *)
|
||||||
|
|
||||||
|
module Utils = Simple_utils.Utils
|
||||||
open Utils
|
open Utils
|
||||||
|
|
||||||
(* Regions
|
(* Regions
|
||||||
@ -23,6 +24,10 @@ module Region = Simple_utils.Region
|
|||||||
|
|
||||||
type 'a reg = 'a Region.reg
|
type 'a reg = 'a Region.reg
|
||||||
|
|
||||||
|
(* Lexemes *)
|
||||||
|
|
||||||
|
type lexeme = string
|
||||||
|
|
||||||
(* Keywords of OCaml *)
|
(* Keywords of OCaml *)
|
||||||
|
|
||||||
type keyword = Region.t
|
type keyword = Region.t
|
||||||
@ -169,7 +174,7 @@ and type_expr =
|
|||||||
| TFun of (type_expr * arrow * type_expr) reg
|
| TFun of (type_expr * arrow * type_expr) reg
|
||||||
| TPar of type_expr par reg
|
| TPar of type_expr par reg
|
||||||
| TVar of variable
|
| TVar of variable
|
||||||
| TString of Lexer.lexeme reg
|
| TString of lexeme reg
|
||||||
|
|
||||||
and cartesian = (type_expr, times) nsepseq reg
|
and cartesian = (type_expr, times) nsepseq reg
|
||||||
|
|
||||||
@ -192,9 +197,9 @@ and pattern =
|
|||||||
| PFalse of kwd_false
|
| PFalse of kwd_false
|
||||||
| PTrue of kwd_true
|
| PTrue of kwd_true
|
||||||
| PVar of variable
|
| PVar of variable
|
||||||
| PInt of (Lexer.lexeme * Z.t) reg
|
| PInt of (lexeme * Z.t) reg
|
||||||
| PNat of (Lexer.lexeme * Z.t) reg
|
| PNat of (lexeme * Z.t) reg
|
||||||
| PBytes of (Lexer.lexeme * Hex.t) reg
|
| PBytes of (lexeme * Hex.t) reg
|
||||||
| PString of string reg
|
| PString of string reg
|
||||||
| PVerbatim of string reg
|
| PVerbatim of string reg
|
||||||
| PWild of wild
|
| PWild of wild
|
||||||
|
@ -1 +0,0 @@
|
|||||||
include CST
|
|
@ -2,12 +2,11 @@
|
|||||||
(name cst_cameligo)
|
(name cst_cameligo)
|
||||||
(public_name ligo.cst.cameligo)
|
(public_name ligo.cst.cameligo)
|
||||||
(libraries
|
(libraries
|
||||||
|
;; Ligo
|
||||||
simple-utils
|
simple-utils
|
||||||
tezos-utils
|
;; Third party
|
||||||
parser_shared
|
hex
|
||||||
)
|
zarith)
|
||||||
|
(modules CST ParserLog)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps ppx_let bisect_ppx --conditional)
|
(pps ppx_let bisect_ppx --conditional)))
|
||||||
)
|
|
||||||
(flags (:standard -open Parser_shared -open Simple_utils ))
|
|
||||||
)
|
|
||||||
|
@ -2,13 +2,7 @@
|
|||||||
(name cst)
|
(name cst)
|
||||||
(public_name ligo.cst)
|
(public_name ligo.cst)
|
||||||
(libraries
|
(libraries
|
||||||
simple-utils
|
|
||||||
tezos-utils
|
|
||||||
cst_cameligo
|
cst_cameligo
|
||||||
cst_pascaligo
|
cst_pascaligo)
|
||||||
)
|
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps ppx_let bisect_ppx --conditional)
|
(pps ppx_let bisect_ppx --conditional)))
|
||||||
)
|
|
||||||
(flags (:standard -open Simple_utils ))
|
|
||||||
)
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
(* Utilities *)
|
(* Utilities *)
|
||||||
|
|
||||||
|
module Utils = Simple_utils.Utils
|
||||||
open Utils
|
open Utils
|
||||||
|
|
||||||
(* Regions
|
(* Regions
|
||||||
@ -23,6 +24,10 @@ module Region = Simple_utils.Region
|
|||||||
|
|
||||||
type 'a reg = 'a Region.reg
|
type 'a reg = 'a Region.reg
|
||||||
|
|
||||||
|
(* Lexemes *)
|
||||||
|
|
||||||
|
type lexeme = string
|
||||||
|
|
||||||
(* Keywords of LIGO *)
|
(* Keywords of LIGO *)
|
||||||
|
|
||||||
type keyword = Region.t
|
type keyword = Region.t
|
||||||
@ -185,7 +190,7 @@ and type_expr =
|
|||||||
| TFun of (type_expr * arrow * type_expr) reg
|
| TFun of (type_expr * arrow * type_expr) reg
|
||||||
| TPar of type_expr par reg
|
| TPar of type_expr par reg
|
||||||
| TVar of variable
|
| TVar of variable
|
||||||
| TString of Lexer.lexeme reg
|
| TString of lexeme reg
|
||||||
|
|
||||||
and cartesian = (type_expr, times) nsepseq reg
|
and cartesian = (type_expr, times) nsepseq reg
|
||||||
|
|
||||||
@ -457,9 +462,9 @@ and expr =
|
|||||||
| EProj of projection reg
|
| EProj of projection reg
|
||||||
| EUpdate of update reg
|
| EUpdate of update reg
|
||||||
| EMap of map_expr
|
| EMap of map_expr
|
||||||
| EVar of Lexer.lexeme reg
|
| EVar of lexeme reg
|
||||||
| ECall of fun_call
|
| ECall of fun_call
|
||||||
| EBytes of (Lexer.lexeme * Hex.t) reg
|
| EBytes of (lexeme * Hex.t) reg
|
||||||
| EUnit of c_Unit
|
| EUnit of c_Unit
|
||||||
| ETuple of tuple_expr
|
| ETuple of tuple_expr
|
||||||
| EPar of expr par reg
|
| EPar of expr par reg
|
||||||
@ -523,14 +528,14 @@ and arith_expr =
|
|||||||
| Div of slash bin_op reg
|
| Div of slash bin_op reg
|
||||||
| Mod of kwd_mod bin_op reg
|
| Mod of kwd_mod bin_op reg
|
||||||
| Neg of minus un_op reg
|
| Neg of minus un_op reg
|
||||||
| Int of (Lexer.lexeme * Z.t) reg
|
| Int of (lexeme * Z.t) reg
|
||||||
| Nat of (Lexer.lexeme * Z.t) reg
|
| Nat of (lexeme * Z.t) reg
|
||||||
| Mutez of (Lexer.lexeme * Z.t) reg
|
| Mutez of (lexeme * Z.t) reg
|
||||||
|
|
||||||
and string_expr =
|
and string_expr =
|
||||||
Cat of cat bin_op reg
|
Cat of cat bin_op reg
|
||||||
| String of Lexer.lexeme reg
|
| String of lexeme reg
|
||||||
| Verbatim of Lexer.lexeme reg
|
| Verbatim of lexeme reg
|
||||||
|
|
||||||
and list_expr =
|
and list_expr =
|
||||||
ECons of cons bin_op reg
|
ECons of cons bin_op reg
|
||||||
@ -570,7 +575,7 @@ and field_path_assignment = {
|
|||||||
|
|
||||||
and selection =
|
and selection =
|
||||||
FieldName of field_name
|
FieldName of field_name
|
||||||
| Component of (Lexer.lexeme * Z.t) reg
|
| Component of (lexeme * Z.t) reg
|
||||||
|
|
||||||
and tuple_expr = (expr, comma) nsepseq par reg
|
and tuple_expr = (expr, comma) nsepseq par reg
|
||||||
|
|
||||||
@ -614,12 +619,12 @@ and ne_injection_kwd =
|
|||||||
|
|
||||||
and pattern =
|
and pattern =
|
||||||
PConstr of constr_pattern
|
PConstr of constr_pattern
|
||||||
| PVar of Lexer.lexeme reg
|
| PVar of lexeme reg
|
||||||
| PWild of wild
|
| PWild of wild
|
||||||
| PInt of (Lexer.lexeme * Z.t) reg
|
| PInt of (lexeme * Z.t) reg
|
||||||
| PNat of (Lexer.lexeme * Z.t) reg
|
| PNat of (lexeme * Z.t) reg
|
||||||
| PBytes of (Lexer.lexeme * Hex.t) reg
|
| PBytes of (lexeme * Hex.t) reg
|
||||||
| PString of Lexer.lexeme reg
|
| PString of lexeme reg
|
||||||
| PList of list_pattern
|
| PList of list_pattern
|
||||||
| PTuple of tuple_pattern
|
| PTuple of tuple_pattern
|
||||||
|
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
(name cst_pascaligo)
|
(name cst_pascaligo)
|
||||||
(public_name ligo.cst.pascaligo)
|
(public_name ligo.cst.pascaligo)
|
||||||
(libraries
|
(libraries
|
||||||
|
;; Ligo
|
||||||
simple-utils
|
simple-utils
|
||||||
tezos-utils
|
;; Third party
|
||||||
parser_shared
|
hex
|
||||||
)
|
zarith)
|
||||||
|
(modules CST ParserLog)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps ppx_let bisect_ppx --conditional)
|
(pps ppx_let bisect_ppx --conditional)))
|
||||||
)
|
|
||||||
(flags (:standard -open Parser_shared -open Simple_utils ))
|
|
||||||
)
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
include CST
|
|
10
vendors/Preprocessor/dune
vendored
10
vendors/Preprocessor/dune
vendored
@ -7,9 +7,15 @@
|
|||||||
(libraries
|
(libraries
|
||||||
getopt
|
getopt
|
||||||
simple-utils)
|
simple-utils)
|
||||||
(modules EvalOpt E_Parser E_Lexer E_AST Preproc)
|
(modules
|
||||||
|
EvalOpt
|
||||||
|
E_Parser
|
||||||
|
E_Lexer
|
||||||
|
E_AST
|
||||||
|
Preproc)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps bisect_ppx --conditional)))
|
(pps bisect_ppx --conditional))
|
||||||
|
(flags (:standard -open Simple_utils)))
|
||||||
|
|
||||||
;; Building the lexers of the preprocessor
|
;; Building the lexers of the preprocessor
|
||||||
|
|
||||||
|
7
vendors/ligo-utils/simple-utils/dune
vendored
7
vendors/ligo-utils/simple-utils/dune
vendored
@ -4,9 +4,6 @@
|
|||||||
(libraries
|
(libraries
|
||||||
yojson
|
yojson
|
||||||
unix
|
unix
|
||||||
str
|
str)
|
||||||
)
|
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps ppx_let)
|
(pps ppx_let)))
|
||||||
)
|
|
||||||
)
|
|
||||||
|
@ -3,20 +3,16 @@ name : "simple-utils"
|
|||||||
version : "dev"
|
version : "dev"
|
||||||
synopsis : "LIGO utilities, to be used by other libraries"
|
synopsis : "LIGO utilities, to be used by other libraries"
|
||||||
maintainer : "Galfour <contact@ligolang.org>"
|
maintainer : "Galfour <contact@ligolang.org>"
|
||||||
authors : "Galfour"
|
authors : "Galfour, Christian Rinderknecht"
|
||||||
license : "MIT"
|
license : "MIT"
|
||||||
homepage : "https://gitlab.com/ligolang/ligo-utils"
|
homepage : "https://gitlab.com/ligolang/ligo-utils"
|
||||||
bug-reports : "https://gitlab.com/ligolang/ligo-utils/issues"
|
bug-reports : "https://gitlab.com/ligolang/ligo-utils/issues"
|
||||||
depends: [
|
depends : ["dune"
|
||||||
"dune"
|
|
||||||
"base"
|
"base"
|
||||||
"yojson"
|
"yojson"
|
||||||
"ppx_let"
|
"ppx_let"
|
||||||
# from ppx_let:
|
# from ppx_let:
|
||||||
"ocaml" {>= "4.04.2" & < "4.08.0"}
|
"ocaml" {>= "4.04.2" & < "4.08.0"}
|
||||||
"dune" {build & >= "1.5.1"}
|
"dune" {build & >= "1.5.1"}
|
||||||
"ppxlib" {>= "0.5.0"}
|
"ppxlib" {>= "0.5.0"}]
|
||||||
]
|
build : [["dune" "build" "-p" name]]
|
||||||
build: [
|
|
||||||
["dune" "build" "-p" name]
|
|
||||||
]
|
|
||||||
|
@ -10,10 +10,14 @@ module Int = X_int
|
|||||||
module Tuple = Tuple
|
module Tuple = Tuple
|
||||||
module Map = X_map
|
module Map = X_map
|
||||||
module Tree = Tree
|
module Tree = Tree
|
||||||
module Region = Region
|
|
||||||
module Pos = Pos
|
|
||||||
module Var = Var
|
module Var = Var
|
||||||
module Ligo_string = X_string
|
module Ligo_string = X_string
|
||||||
module Display = Display
|
module Display = Display
|
||||||
module Runned_result = Runned_result
|
module Runned_result = Runned_result
|
||||||
|
|
||||||
|
(* Originally by Christian Rinderknecht *)
|
||||||
|
|
||||||
|
module Pos = Pos
|
||||||
|
module Region = Region
|
||||||
|
module Utils = Utils
|
||||||
|
module FQueue = FQueue
|
||||||
|
Loading…
Reference in New Issue
Block a user