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
e21c419c
Commit
e21c419c
authored
May 25, 2020
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Infer: isolate the auxiliary function [tokentype].
parent
9b9a4b0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
src/infer.ml
src/infer.ml
+14
-9
No files found.
src/infer.ml
View file @
e21c419c
...
...
@@ -55,8 +55,19 @@ let mliname =
(* ------------------------------------------------------------------------- *)
(* Code production. *)
(* [nttype nt] is the type of the nonterminal [nt], as currently
known. *)
(* [tokentype grammar symbol] returns the type of the terminal symbol
[symbol], if [symbol] is indeed a terminal symbol. Otherwise, it
raises [Not_found]. *)
let
tokentype
grammar
symbol
=
let
props
=
StringMap
.
find
symbol
grammar
.
tokens
in
match
props
.
tk_ocamltype
with
|
None
->
tunit
|
Some
ocamltype
->
TypTextual
ocamltype
(* [nttype nt] is the type of the nonterminal [nt], as currently known. *)
let
nttype
grammar
nt
=
try
...
...
@@ -96,13 +107,7 @@ let actiondef grammar symbol branch =
in
let
t
=
try
let
props
=
StringMap
.
find
symbol
grammar
.
tokens
in
(* Symbol is a terminal. *)
match
props
.
tk_ocamltype
with
|
None
->
tunit
|
Some
ocamltype
->
TypTextual
ocamltype
tokentype
grammar
symbol
with
Not_found
->
(* Symbol is a nonterminal. *)
nttype
grammar
symbol
...
...
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