Small refactoring.

This commit is contained in:
Christian Rinderknecht 2019-03-07 12:24:57 +01:00
parent c0f541a803
commit ee8ff6ce41
No known key found for this signature in database
GPG Key ID: 9446816CFD267040
3 changed files with 501 additions and 506 deletions

975
AST.ml

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
%{ %{
(* START HEADER *) (* START HEADER *)
[@@@warning "-42"]
open Region open Region
open AST open AST
@ -288,7 +290,7 @@ const_decl:
var_decl: var_decl:
Var var COLON type_expr ASGNMNT expr { Var var COLON type_expr ASGNMNT expr {
let region = cover $1 (expr_to_region $6) in let region = cover $1 (expr_to_region $6) in
let value = { let value = {
kwd_var = $1; kwd_var = $1;
name = $2; name = $2;
colon = $3; colon = $3;

28
dune
View File

@ -4,24 +4,14 @@
(menhir (menhir
(merge_into Parser) (merge_into Parser)
(modules ParToken Parser) (modules ParToken Parser)
(flags -la 1 --explain --external-tokens LexToken) (flags -la 1 --explain --external-tokens LexToken))
)
(executables (executables
(names LexerMain ParserMain) (names LexerMain ParserMain)
(public_names ligo-lexer ligo-parser) (public_names ligo-lexer ligo-parser)
(package ligo-parser) (package ligo-parser)
(modules_without_implementation (modules_without_implementation Error)
Error (libraries getopt hex str uutf zarith))
)
(libraries
hex
zarith
getopt
uutf
str
)
)
;; Les deux directives (rule) qui suivent sont pour le dev local. ;; Les deux directives (rule) qui suivent sont pour le dev local.
;; Il suffit de faire "dune build Parser.exe" pour avoir un Parser.exe dans le dossier. ;; Il suffit de faire "dune build Parser.exe" pour avoir un Parser.exe dans le dossier.
@ -30,15 +20,13 @@
(targets Parser.exe) (targets Parser.exe)
(deps ParserMain.exe) (deps ParserMain.exe)
(action (copy ParserMain.exe Parser.exe)) (action (copy ParserMain.exe Parser.exe))
(mode promote-until-clean) (mode promote-until-clean))
)
(rule (rule
(targets Lexer.exe) (targets Lexer.exe)
(deps LexerMain.exe) (deps LexerMain.exe)
(action (copy LexerMain.exe Lexer.exe)) (action (copy LexerMain.exe Lexer.exe))
(mode promote-until-clean) (mode promote-until-clean))
)
(rule (rule
(targets .git_main_dir) (targets .git_main_dir)
@ -60,12 +48,10 @@
(targets Version.gitHEAD) (targets Version.gitHEAD)
(deps .gitHEAD) (deps .gitHEAD)
;; TODO: re-compute .git_main_dir, just in case (since it does not have a dependency on .git) ;; TODO: re-compute .git_main_dir, just in case (since it does not have a dependency on .git)
(action (run "sh" "-c" "if git symbolic-ref HEAD >/dev/null 2>&1; then ln -s \"$(cat .git_main_dir)/$(git symbolic-ref HEAD)\" Version.gitHEAD; else ln -s \"$(cat .git_worktree_dir)/HEAD\" Version.gitHEAD; fi")) (action (run "sh" "-c" "if git symbolic-ref HEAD >/dev/null 2>&1; then ln -s \"$(cat .git_main_dir)/$(git symbolic-ref HEAD)\" Version.gitHEAD; else ln -s \"$(cat .git_worktree_dir)/HEAD\" Version.gitHEAD; fi")))
)
(rule (rule
(targets Version.ml) (targets Version.ml)
(deps Version.gitHEAD) (deps Version.gitHEAD)
(action (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(cat Version.gitHEAD)\" > Version.ml")) (action (run "sh" "-c" "printf 'let version = \"%s\"'\\\\n \"$(cat Version.gitHEAD)\" > Version.ml"))
(mode promote-until-clean) (mode promote-until-clean))
)