Commit ca24eea7 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

compilation for acg doesn't work yet

parent 280903ec
# Version 1.5.0
## The acgc.opt/acgc compiler and the acg.opt/acg interpreter:
* Removed the dependency to BOLT (replaced by Logs) and dypgen (replaced by menhir)
* Some syntax changes:
1. Prefix operators have the highest priority
2. Infix operators have a higher priority than application (*Note: this may break existing code*)
3. An associativity property (none, left, right) can be set to infix operators (left is the default), and a precedence level as well
# Version 1.4.0 # Version 1.4.0
## The acgc.opt/acgc compiler and the acg.opt/acg interpreter: ## The acgc.opt/acgc compiler and the acg.opt/acg interpreter:
* Improved performance by better logging management (for debug) * Improved performance by better logging management (for debug)
......
...@@ -146,8 +146,18 @@ if it has to." ...@@ -146,8 +146,18 @@ if it has to."
(add-hook 'acg-mode-hook 'acg-set-compile-command) (add-hook 'acg-mode-hook 'acg-set-compile-command)
(require 'compile) (require 'compile)
;; Add colors to the emacs buffer
(require 'ansi-color)
(defun colorize-compilation-buffer ()
(toggle-read-only)
(ansi-color-apply-on-region compilation-filter-start (point))
(toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
;; find the line of the error ;; find the line of the error
(defconst acg-error-regexp (defconst acg-error-regexp
;; "^[^\0-@]+ \"\\([^\"\n]+\\)\", [^\0-@]+ \\([0-9]+\\)[-,:]" ;; "^[^\0-@]+ \"\\([^\"\n]+\\)\", [^\0-@]+ \\([0-9]+\\)[-,:]"
......
(* This files gives an example of how to use the ACG toolkit to illustrate (* This files gives an example of how to use the ACG toolkit to illustrate
Montague's semantics on a bilingual fragment (French, English). *) Montague's semantics on a bilingual fragment (French, English). *)
(* First we define the syntactic categories and the syntactic terms. *) (* First we define the syntactic categories and the syntactic terms. *)
signature syntax = signature syntax =
(* the syntactic types *) (* the syntactic types *)
...@@ -66,7 +65,7 @@ lexicon realisation_francais (syntax) : francais = ...@@ -66,7 +65,7 @@ lexicon realisation_francais (syntax) : francais =
returns the concatenation subject+loves+object *) returns the concatenation subject+loves+object *)
AIMER := lambda o s.s + aime + o; AIMER := lambda o s.s + aime + o;
VOULOIR_CV := lambda vp. Lambda s. s + veut + vp e; VOULOIR_CV := lambda vp. Lambda s. s + veut + (vp e);
VOULOIR_SC := lambda sc s. s + veut + sc; VOULOIR_SC := lambda sc s. s + veut + sc;
CHAQUE := lambda n P. P (chaque + n); CHAQUE := lambda n P. P (chaque + n);
...@@ -112,7 +111,7 @@ lexicon realisation_anglais (syntax) : anglais = ...@@ -112,7 +111,7 @@ lexicon realisation_anglais (syntax) : anglais =
(* LOVE is interpreted as a function taking two arguments. The first one is the object and the second one is the subject. It returns the concatenation subject+loves+object *) (* LOVE is interpreted as a function taking two arguments. The first one is the object and the second one is the subject. It returns the concatenation subject+loves+object *)
AIMER := lambda o s.s + loves + o; AIMER := lambda o s.s + loves + o;
VOULOIR_CV := lambda vp. Lambda s. s + wants + to + vp e; VOULOIR_CV := lambda vp. Lambda s. s + wants + to + (vp e);
VOULOIR_SC := lambda sc s. s + wants + sc; VOULOIR_SC := lambda sc s. s + wants + sc;
CHAQUE := lambda n P. P (every + n); CHAQUE := lambda n P. P (every + n);
......
This diff is collapsed.
This diff is collapsed.
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
(**************************************************************************) (**************************************************************************)
open UtilsLib open UtilsLib
(*open Grammars.Environment*) open AcgData.Environment
let info fd name = let info fd name =
let w,h = let w,h =
...@@ -121,6 +121,10 @@ sig ...@@ -121,6 +121,10 @@ sig
val svg : context -> string option val svg : context -> string option
val dirs : context -> string list
val parse_script : context -> (?verbose:bool -> ?svg_output:string option -> string -> string list -> Environment.t -> Environment.t)
val help : action -> unit val help : action -> unit
val exit : unit -> unit val exit : unit -> unit
...@@ -148,7 +152,8 @@ struct ...@@ -148,7 +152,8 @@ struct
wait:bool; (* whether a user return keypressed is expected before moving to the next command *) wait:bool; (* whether a user return keypressed is expected before moving to the next command *)
echo:bool; (* whether the command should be echoed on the output *) echo:bool; (* whether the command should be echoed on the output *)
dirs:string list; (* list of the included dirs *) dirs:string list; (* list of the included dirs *)
svg:string option (* whether a svg output "file" (if relevant) should be produced *) svg:string option; (* whether a svg output "file" (if relevant) should be produced *)
parse_function: parse_script : context -> (?verbose:bool -> ?svg_output:string option -> string -> string list -> Environment.t -> Environment.t);
} }
...@@ -778,6 +783,10 @@ struct ...@@ -778,6 +783,10 @@ struct
let echo ctx = ctx.echo let echo ctx = ctx.echo
let svg ctx = ctx.svg let svg ctx = ctx.svg
let dirs ctx = ctx.dirs
let parse_script ctx = ctx.parse_function
let exit () = raise Quit let exit () = raise Quit
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
(**************************************************************************) (**************************************************************************)
val info : Unix.file_descr -> string -> unit val info : Unix.file_descr -> string -> unit
open AcgData.Environment
module type Action_sig = module type Action_sig =
...@@ -108,6 +108,10 @@ sig ...@@ -108,6 +108,10 @@ sig
val svg : context -> string option val svg : context -> string option
val dirs : context -> string list
val parse_script : context -> (?verbose:bool -> ?svg_output:string option -> string -> string list -> Environment.t -> Environment.t)
val help : action -> unit val help : action -> unit
val exit : unit -> unit val exit : unit -> unit
......
(* This file was auto-generated based on "command_parser.messages.new". *)
(* Please note that the function [message] can raise [Not_found]. *)
let message =
fun s ->
match s with
| 1 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 91 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 3 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 5 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 0 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 7 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 8 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 10 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 90 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 13 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 16 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 19 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 23 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 88 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 28 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 31 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 33 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 73 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 34 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 76 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 37 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 39 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 42 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 41 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 44 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 46 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 47 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 49 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 50 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 51 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 52 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 54 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 56 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 57 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 58 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 59 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 60 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 62 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 65 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| 68 ->
"<YOUR SYNTAX ERROR MESSAGE HERE>\n"
| _ ->
raise Not_found
...@@ -20,52 +20,7 @@ ...@@ -20,52 +20,7 @@
{ {
open Logic.Abstract_syntax open Logic.Abstract_syntax
open AcgData open AcgData
(* open Script_parser*) open Command_parser
(* | STRING of (string*Abstract_syntax.location)*)
type token =
| EOII
| LOAD_DATA of (string*Abstract_syntax.location*string)
| LOAD_SCRIPT of (string*Abstract_syntax.location*string)
| LOAD_OBJECT of (string*Abstract_syntax.location*string)
| LOAD_HELP
| LIST
| SELECT
| UNSELECT
| TRACE
| PRINT of Abstract_syntax.location
| ANALYSE of (string*Abstract_syntax.location*string)
| ANALYSE_HELP
| CHECK of (string*Abstract_syntax.location*string)
| CHECK_HELP
| REALIZE of (string*Abstract_syntax.location*string)
| REALIZE_HELP
| REALIZE_SHOW of (string*Abstract_syntax.location*string)
| REALIZE_SHOW_HELP
| PARSE of (string*Abstract_syntax.location*string)
| PARSE_HELP
| IDB of Abstract_syntax.location
| QUERY of (string*Abstract_syntax.location*string)
| QUERY_HELP
| ADD of (string*Abstract_syntax.location*string)
| ADD_HELP
| COMPOSE
| SEMICOLONN of string
| AS
| DONT
| WAIT
| EXIT
| IDENTT of (string*Abstract_syntax.location)
| HELP
| CREATE_SIG
| CREATE_LEX
| CREATE_HELP
| SAVE of (string*Abstract_syntax.location*string)
| SAVE_HELP
let loc lexbuf = Lexing.lexeme_start_p lexbuf,Lexing.lexeme_end_p lexbuf let loc lexbuf = Lexing.lexeme_start_p lexbuf,Lexing.lexeme_end_p lexbuf
let string_content = Buffer.create 16 let string_content = Buffer.create 16
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment