What's wrong with this code? I can't figure it out:
let parent (rules : grammar) (symbol1 : string) (symbol2 : string) : (SymbolSet.t) =
try
SymbolSet.singleton (getParent [symbol1; symbol2] rules)
with
Not_found -> SymbolSet.singleton "";;
let fundementalRule (set1 : SymbolSet) (set2 : SymbolSet) (rules : grammar) : (SymbolSet) =
allpairs (parent rules) set1 set2;;
Characters 20-21:
let fundementalRule (set1 : SymbolSet) (set2 : SymbolSet) (rules : grammar) : (SymbolSet) =
^
Syntax error: ')' expected, the highlighted '(' might be unmatched
The parenthesis is matched. What then is causing this issue?
This is just fine:
let fundementalRule set1 set2 rules =
allpairs (parent rules) set1 set2;;
asked Nov 7, 2009 at 21:17
Nick Heiner
123k193 gold badges487 silver badges706 bronze badges
2 Answers 2
maybe the types should be SymbolSet.t instead of SymbolSet
answered Nov 8, 2009 at 2:12
newacct
123k29 gold badges168 silver badges227 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Bruno De Fraine
SymbolSet by itself is not a valid type expression; the message from the Ocaml compiler is incorrect, this is because it uses the "error" mechanism of ocamlyacc (and yacc) to guess what the error may be.What's on the line above it? I'd be willing to bet that there is an unmatched paren somewhere before this code.
Update
My intuition is telling me that the error is here:
SymbolSet.singleton (getParent [symbol1; symbol2] rules)
I don't have any way to test this code, but I do get an error when I try to run this code:
# let foo arg1 listarg arg2 = ();;
val foo : 'a -> 'b -> 'c -> unit = <fun>
# foo (1 [1; 2] 2);;
Error: This expression is not a function; it cannot be applied
I think that should be this:
SymbolSet.singleton getParent [symbol1; symbol2] rules
answered Nov 7, 2009 at 21:24
Jason Baker
200k140 gold badges388 silver badges522 bronze badges
Comments
lang-ml