Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
menhir
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
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 @@
...
@@ -2,4 +2,4 @@
which could be produced by either ocamlyacc or Menhir. *)
which could be produced by either ocamlyacc or Menhir. *)
val
grammar
:
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
...
@@ -29,7 +29,7 @@ open Positions
/*
-------------------------------------------------------------------------
*/
/*
-------------------------------------------------------------------------
*/
/*
Start
symbol
.
*/
/*
Start
symbol
.
*/
%
start
<
Syntax
.
grammar
>
grammar
%
start
<
Syntax
.
partial_
grammar
>
grammar
/*
-------------------------------------------------------------------------
*/
/*
-------------------------------------------------------------------------
*/
/*
Priorities
.
*/
/*
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
Positions
open
Syntax
open
Syntax
open
UnparameterizedSyntax
open
UnparameterizedSyntax
open
InternalSyntax
open
Misc
open
Misc
(* Inference for non terminals. *)
(* Inference for non terminals. *)
...
@@ -249,7 +248,7 @@ let rec parameter_type env = function
...
@@ -249,7 +248,7 @@ let rec parameter_type env = function
[Star] otherwise it is the flexible variable. *)
[Star] otherwise it is the flexible variable. *)
star_variable
star_variable
let
check_grammar
p_grammar
=
let
check_grammar
(
p_grammar
:
Syntax
.
grammar
)
=
(* [n] is the grammar size. *)
(* [n] is the grammar size. *)
let
n
=
StringMap
.
cardinal
p_grammar
.
p_rules
in
let
n
=
StringMap
.
cardinal
p_grammar
.
p_rules
in
...
...
src/parameterizedGrammar.mli
View file @
88220d13
...
@@ -10,6 +10,4 @@
...
@@ -10,6 +10,4 @@
sanitized via [Misc.normalize] when printed in a context where a
sanitized via [Misc.normalize] when printed in a context where a
valid identifier is expected. *)
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
Misc
open
Syntax
open
Syntax
open
InternalSyntax
open
Positions
open
Positions
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
...
@@ -432,7 +431,7 @@ let iter_on_only_used_symbols f t =
...
@@ -432,7 +431,7 @@ let iter_on_only_used_symbols f t =
|
_
->
()
)
|
_
->
()
)
t
t
let
symbols_of
grammar
(
pgrammar
:
Syntax
.
grammar
)
=
let
symbols_of
grammar
(
pgrammar
:
Syntax
.
partial_
grammar
)
=
let
tokens
=
grammar
.
p_tokens
in
let
tokens
=
grammar
.
p_tokens
in
let
symbols_of_rule
symbols
prule
=
let
symbols_of_rule
symbols
prule
=
let
rec
store_except_rule_parameters
=
let
rec
store_except_rule_parameters
=
...
...
src/partialGrammar.mli
View file @
88220d13
open
Syntax
val
join_partial_grammars
:
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
(* Terminals and nonterminal symbols are strings. Identifiers
(which are used to refer to a symbol's semantic value) are
(which are used to refer to a symbol's semantic value) are
strings. A file name is a string. *)
strings. A file name is a string. *)
...
@@ -17,16 +27,24 @@ type identifier =
...
@@ -17,16 +27,24 @@ type identifier =
type
filename
=
type
filename
=
string
string
(* ------------------------------------------------------------------------ *)
(* A trailer is a source file fragment. *)
(* A trailer is a source file fragment. *)
type
trailer
=
type
trailer
=
Stretch
.
t
Stretch
.
t
(* ------------------------------------------------------------------------ *)
(* OCaml semantic actions are represented as stretches. *)
(* OCaml semantic actions are represented as stretches. *)
type
action
=
type
action
=
Action
.
t
Action
.
t
(* ------------------------------------------------------------------------ *)
(* Information about tokens. *)
type
token_associativity
=
type
token_associativity
=
LeftAssoc
LeftAssoc
|
RightAssoc
|
RightAssoc
...
@@ -52,6 +70,8 @@ type token_properties =
...
@@ -52,6 +70,8 @@ type token_properties =
mutable
tk_is_declared
:
bool
;
mutable
tk_is_declared
:
bool
;
}
}
(* ------------------------------------------------------------------------ *)
type
parameter
=
type
parameter
=
|
ParameterVar
of
symbol
Positions
.
located
|
ParameterVar
of
symbol
Positions
.
located
|
ParameterApp
of
symbol
Positions
.
located
*
parameters
|
ParameterApp
of
symbol
Positions
.
located
*
parameters
...
@@ -123,10 +143,22 @@ type parameterized_rule =
...
@@ -123,10 +143,22 @@ type parameterized_rule =
pr_branches
:
parameterized_branch
list
;
pr_branches
:
parameterized_branch
list
;
}
}
type
grammar
=
type
partial_
grammar
=
{
{
pg_filename
:
filename
;
pg_filename
:
filename
;
pg_declarations
:
declaration
Positions
.
located
list
;
pg_declarations
:
declaration
Positions
.
located
list
;
pg_rules
:
parameterized_rule
list
;
pg_rules
:
parameterized_rule
list
;
pg_trailer
:
trailer
option
;
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
...
@@ -20,7 +20,7 @@ open Positions
%
token
<
Stretch
.
t
Lazy
.
t
>
PERCENTPERCENT
%
token
<
Stretch
.
t
Lazy
.
t
>
PERCENTPERCENT
%
token
<
Syntax
.
identifier
option
array
->
Syntax
.
action
>
ACTION
%
token
<
Syntax
.
identifier
option
array
->
Syntax
.
action
>
ACTION
%
start
grammar
%
start
grammar
%
type
<
Syntax
.
grammar
>
grammar
%
type
<
Syntax
.
partial_
grammar
>
grammar
/*
These
declarations
solve
a
shift
-
reduce
conflict
in
favor
of
/*
These
declarations
solve
a
shift
-
reduce
conflict
in
favor
of
shifting
:
when
the
declaration
of
a
non
-
terminal
symbol
begins
with
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