Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
POTTIER Francois
menhir
Commits
88220d13
Commit
88220d13
authored
May 18, 2016
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the file [InternalSyntax].
parent
d43802e0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
23 deletions
+42
-23
src/Driver.mli
src/Driver.mli
+1
-1
src/fancy-parser.mly
src/fancy-parser.mly
+1
-1
src/internalSyntax.mli
src/internalSyntax.mli
+0
-11
src/parameterizedGrammar.ml
src/parameterizedGrammar.ml
+1
-2
src/parameterizedGrammar.mli
src/parameterizedGrammar.mli
+1
-3
src/partialGrammar.ml
src/partialGrammar.ml
+1
-2
src/partialGrammar.mli
src/partialGrammar.mli
+3
-1
src/syntax.mli
src/syntax.mli
+33
-1
src/yacc-parser.mly
src/yacc-parser.mly
+1
-1
No files found.
src/Driver.mli
View file @
88220d13
...
...
@@ -2,4 +2,4 @@
which could be produced by either ocamlyacc or Menhir. *)
val
grammar
:
(
Lexing
.
lexbuf
->
Parser
.
token
)
->
Lexing
.
lexbuf
->
Syntax
.
grammar
(
Lexing
.
lexbuf
->
Parser
.
token
)
->
Lexing
.
lexbuf
->
Syntax
.
partial_
grammar
src/fancy-parser.mly
View file @
88220d13
...
...
@@ -29,7 +29,7 @@ open Positions
/*
-------------------------------------------------------------------------
*/
/*
Start
symbol
.
*/
%
start
<
Syntax
.
grammar
>
grammar
%
start
<
Syntax
.
partial_
grammar
>
grammar
/*
-------------------------------------------------------------------------
*/
/*
Priorities
.
*/
...
...
src/internalSyntax.mli
deleted
100644 → 0
View file @
d43802e0
type
grammar
=
{
p_preludes
:
Stretch
.
t
list
;
p_postludes
:
Syntax
.
trailer
list
;
p_parameters
:
Stretch
.
t
list
;
p_start_symbols
:
Positions
.
t
StringMap
.
t
;
p_types
:
(
Syntax
.
parameter
*
Stretch
.
ocamltype
Positions
.
located
)
list
;
p_tokens
:
Syntax
.
token_properties
StringMap
.
t
;
p_rules
:
Syntax
.
parameterized_rule
StringMap
.
t
;
p_on_error_reduce
:
Syntax
.
parameter
list
;
}
src/parameterizedGrammar.ml
View file @
88220d13
open
Positions
open
Syntax
open
UnparameterizedSyntax
open
InternalSyntax
open
Misc
(* Inference for non terminals. *)
...
...
@@ -249,7 +248,7 @@ let rec parameter_type env = function
[Star] otherwise it is the flexible variable. *)
star_variable
let
check_grammar
p_grammar
=
let
check_grammar
(
p_grammar
:
Syntax
.
grammar
)
=
(* [n] is the grammar size. *)
let
n
=
StringMap
.
cardinal
p_grammar
.
p_rules
in
...
...
src/parameterizedGrammar.mli
View file @
88220d13
...
...
@@ -10,6 +10,4 @@
sanitized via [Misc.normalize] when printed in a context where a
valid identifier is expected. *)
val
expand
:
InternalSyntax
.
grammar
->
UnparameterizedSyntax
.
grammar
val
expand
:
Syntax
.
grammar
->
UnparameterizedSyntax
.
grammar
src/partialGrammar.ml
View file @
88220d13
open
Misc
open
Syntax
open
InternalSyntax
open
Positions
(* ------------------------------------------------------------------------- *)
...
...
@@ -432,7 +431,7 @@ let iter_on_only_used_symbols f t =
|
_
->
()
)
t
let
symbols_of
grammar
(
pgrammar
:
Syntax
.
grammar
)
=
let
symbols_of
grammar
(
pgrammar
:
Syntax
.
partial_
grammar
)
=
let
tokens
=
grammar
.
p_tokens
in
let
symbols_of_rule
symbols
prule
=
let
rec
store_except_rule_parameters
=
...
...
src/partialGrammar.mli
View file @
88220d13
open
Syntax
val
join_partial_grammars
:
Syntax
.
grammar
list
->
InternalSyntax
.
grammar
partial_
grammar
list
->
grammar
src/syntax.mli
View file @
88220d13
(* The type [partial_grammar] describes the abstract syntax that is produced
by the parsers (yacc-parser and fancy-parser).
The type [grammar] describes the abstract syntax that is obtained after one
or more partial grammars are joined (see [PartialGrammar]). It differs in
that declarations are organized in a more useful way and a number of
well-formedness checks have been performed. *)
(* ------------------------------------------------------------------------ *)
(* Terminals and nonterminal symbols are strings. Identifiers
(which are used to refer to a symbol's semantic value) are
strings. A file name is a string. *)
...
...
@@ -17,16 +27,24 @@ type identifier =
type
filename
=
string
(* ------------------------------------------------------------------------ *)
(* A trailer is a source file fragment. *)
type
trailer
=
Stretch
.
t
(* ------------------------------------------------------------------------ *)
(* OCaml semantic actions are represented as stretches. *)
type
action
=
Action
.
t
(* ------------------------------------------------------------------------ *)
(* Information about tokens. *)
type
token_associativity
=
LeftAssoc
|
RightAssoc
...
...
@@ -52,6 +70,8 @@ type token_properties =
mutable
tk_is_declared
:
bool
;
}
(* ------------------------------------------------------------------------ *)
type
parameter
=
|
ParameterVar
of
symbol
Positions
.
located
|
ParameterApp
of
symbol
Positions
.
located
*
parameters
...
...
@@ -123,10 +143,22 @@ type parameterized_rule =
pr_branches
:
parameterized_branch
list
;
}
type
grammar
=
type
partial_
grammar
=
{
pg_filename
:
filename
;
pg_declarations
:
declaration
Positions
.
located
list
;
pg_rules
:
parameterized_rule
list
;
pg_trailer
:
trailer
option
;
}
type
grammar
=
{
p_preludes
:
Stretch
.
t
list
;
p_postludes
:
trailer
list
;
p_parameters
:
Stretch
.
t
list
;
p_start_symbols
:
Positions
.
t
StringMap
.
t
;
p_types
:
(
parameter
*
Stretch
.
ocamltype
Positions
.
located
)
list
;
p_tokens
:
token_properties
StringMap
.
t
;
p_rules
:
parameterized_rule
StringMap
.
t
;
p_on_error_reduce
:
parameter
list
;
}
src/yacc-parser.mly
View file @
88220d13
...
...
@@ -20,7 +20,7 @@ open Positions
%
token
<
Stretch
.
t
Lazy
.
t
>
PERCENTPERCENT
%
token
<
Syntax
.
identifier
option
array
->
Syntax
.
action
>
ACTION
%
start
grammar
%
type
<
Syntax
.
grammar
>
grammar
%
type
<
Syntax
.
partial_
grammar
>
grammar
/*
These
declarations
solve
a
shift
-
reduce
conflict
in
favor
of
shifting
:
when
the
declaration
of
a
non
-
terminal
symbol
begins
with
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment