02:37
GreyLensman has joined #ocaml
02:38
<
vincenz >
is there unicode support for ocaml?
02:43
solarwind has quit [Read error: 110 (Connection timed out)]
02:53
<
Demitar >
vincenz, yes. (Depends on exactly what you want of course.)
03:04
<
vincenz >
I'm trying to build a lexer that recognizes utf
03:04
<
vincenz >
for lexer
03:04
<
vincenz >
if I have letter = ['a'-'z']
03:04
<
vincenz >
let digit = ['0'-'9']
03:04
<
vincenz >
how do I combine these two?
03:07
<
vincenz >
nm, got it
03:13
zigong_ has joined #ocaml
03:27
<
vincenz >
Demitar: do you know how to use the ocamllexer well?
03:31
<
Demitar >
vincenz, yes and no. :)
03:31
<
Demitar >
vincenz, what you want is wlex or ulex.
03:47
<
vincenz >
are they any good?
03:48
<
Demitar >
Haven't used them. What are you lexing btw?
04:04
GreyLensman has quit ["Leaving"]
04:04
<
vincenz >
question about parser
04:04
<
vincenz >
if you have a rule in BNF
04:05
<
vincenz >
is there an easy way to do this?
04:07
<
Demitar >
What do {} mean in bnf?
04:07
* vincenz
mutters at the specs
04:07
<
vincenz >
how stupid
04:07
<
Nutssh >
Define your notation with {}
04:07
<
Demitar >
And take into account that I should be sleeping... :)
04:07
<
vincenz >
bnf {} means zero or more of
04:08
<
vincenz >
'a' {'b'}
04:08
<
vincenz >
is: a, ab, abb, abbb
04:08
<
vincenz >
man the java specs are dumb
04:08
<
Demitar >
It's a regexp in ocamllex.
04:08
<
vincenz >
Demitar: nono...this was an example
04:08
<
vincenz >
I'm doing syntax now
04:08
<
Demitar >
Thus 'b'*
04:09
<
vincenz >
I was merely explaining {}
04:09
<
vincenz >
I'm doing syntax
04:09
<
vincenz >
aka parser
04:09
<
vincenz >
lexer is done
04:09
<
vincenz >
how stupid
04:09
<
vincenz >
qualified_identifier:
04:09
<
vincenz >
identifier {DOT identifier}
04:09
<
vincenz >
then later
04:09
<
Demitar >
Well recursiveness is the key in the parser.
04:09
<
Nutssh >
Thats pretty easy. SPlit it into two nonterminals B ::= b B | b A ::= A B C | A C
04:09
<
vincenz >
identifier {DOT identifier} brackets_opt
04:09
* vincenz
palmslaps
04:09
<
vincenz >
just put qualified_identifier then!
04:12
<
vincenz >
man they just have a really fucked up bnf
04:12
<
vincenz >
check this
04:12
<
vincenz >
expression1:
04:12
<
vincenz >
expression2 [expression1rest]
04:12
<
vincenz >
where [] means optional
04:12
<
vincenz >
expression1rest:
04:12
<
vincenz >
[? expression : expression1]
04:13
<
vincenz >
call about redundant []
04:13
<
vincenz >
s/call/talk
04:14
<
Demitar >
Good to hear java isn't merely evil as a language but even the specs are evil. ;-)
04:16
<
vincenz >
ack, even more crap
04:17
<
vincenz >
I'm never quite sure whether I should turn b: {a } into
04:18
<
vincenz >
b_recurse
04:18
<
vincenz >
with b_recurse either
04:18
<
vincenz >
b_recurse:
04:18
<
vincenz >
| b_recurse a
04:18
<
vincenz >
or | a b_recurse
04:18
<
vincenz >
hmm left to right most likely dictates the second
04:19
* vincenz
does qualified_identifiers right to left and the rest left to right
04:22
<
vincenz >
their bnf doesn't even take care of operator-precende
04:22
<
vincenz >
precedence
04:23
<
vincenz >
oh well, I'll backpatch it later
04:25
<
Nutssh >
Keep it simple and systematic. ANytime you see {x} turn that into X ::= x X | epsilon .
04:26
<
vincenz >
yeah I know
04:26
<
vincenz >
but not for qids
04:26
<
Nutssh >
Err, you're using ocamlyacc, thats an LALR, left recursive isn't a problem.
04:26
<
vincenz >
qualified identifier
04:26
<
vincenz >
I'd rather have (C (Y (X)))
04:26
<
vincenz >
the rest I'm doing x X
04:27
<
vincenz >
sadly their bnf doesn't take care of operator overloading :/
04:27
<
vincenz >
I mean operator precedence
04:28
<
Nutssh >
What is this for? Can you reuse another java parser and avoid the whole hangup?
04:29
<
Nutssh >
Why not play with CIL and analyze and manipulate C code? CIL can gobble the linux kernel!
04:31
<
vincenz >
I've looked at cil
04:31
<
vincenz >
sadly I need to parse c++
04:33
<
vincenz >
and there's nothing good out there
04:40
lus|wazz has joined #ocaml
04:40
<
Nutssh >
C++ grammar is AFAIK insane. Maybe try to write an extension to CIL for C++? :)
04:40
<
vincenz >
a) impossible
04:40
<
vincenz >
b) useleess
04:40
<
vincenz >
you need SGLR or GLR to parse C++
04:40
<
vincenz >
only two opensource systems do it (actually 3)
04:41
<
vincenz >
elsa from same guy as cil
04:41
<
vincenz >
and transformers or codeboost that work on stratego
04:41
<
vincenz >
sadly elsa doesn't cover certain things and has an AST-format that's too flattened
04:41
<
vincenz >
transformers gives you perfect input to output but does no semantic analysis at all (except to disambiguate the syntax)
04:42
<
vincenz >
codeboost does some semantic analysis, but sadly no template instantiation so I'll have to do that by hand
04:42
<
vincenz >
if you consider that it took microsoft 2 years to get it right
04:43
<
vincenz >
as for the uselessness, cil flattens too much
04:43
<
Nutssh >
I don't know how hard it is to parse C++.
04:43
<
vincenz >
Nutssh: consider that the syntax has ambiguities
04:44
<
vincenz >
transformers uses stratego which allows trees with ambiguous leaves
04:44
lus|wazz has quit [Client Quit]
04:44
* Nutssh
nods. Whats wrong with flattening?
04:44
<
vincenz >
and then does some post processing (pruning) to select the right leaves
04:44
<
vincenz >
Nutssh: I need to do source to source transformations that leave the code as much as possible as i
04:44
<
vincenz >
one example
04:44
<
vincenz >
elsa and cil turn
04:44
<
vincenz >
(*((a) + (i)))
04:44
<
vincenz >
well elsa adds the extra parens, cil does that better
04:45
<
Nutssh >
Whats wrong with that other than the lost type information? (which doesn't matter for C)
04:45
lus|wazz has joined #ocaml
04:45
<
vincenz >
the fact that after me come other optimisation steps, not done by me
04:45
<
vincenz >
that are specific for arrays
04:45
<
vincenz >
(loop-unrolling, data-morphing, etc)
04:46
<
Nutssh >
[] is a syntatic abbreviation---are you sure that modern compilers give it a semantic meaning in optimization passes?
04:46
<
vincenz >
preferably I can get the exact input (well without whitespace,indent and comments) in the output if I don't do any actual transformations
04:46
<
vincenz >
Nutssh: compilers don't, tools made in my research group do
04:46
<
vincenz >
most loop and data transformations work on regular arrays
04:47
<
vincenz >
and thus scan for array accesses
04:47
<
vincenz >
though I doubt they can do much with c++
04:47
<
vincenz >
they only handle c
04:48
<
vincenz >
but my advisor forces me to do C++
04:48
<
vincenz >
(I'm the very first step in our metaflow so I need to be as general as possible)
04:48
<
Nutssh >
Ah. Alter unparser to rewrite: *a+b into a[b]?
04:49
<
vincenz >
yeah I know
04:49
<
vincenz >
I'm still not sure whether to go for elsa or codeboost
04:49
<
vincenz >
I'll have to look into codeboost first
04:49
<
vincenz >
but afaik elsa doesn't handle templates
04:49
<
vincenz >
stratego is a nice framework though
04:49
<
vincenz >
language-independent tranformation framework
04:50
<
vincenz >
you write transformation rules for any ast
04:50
<
vincenz >
as well as strategies to use those rules
04:50
<
Nutssh >
I'm not familiar to compilers to that depth. :)
04:50
<
vincenz >
it's not quite a compiler
04:50
<
vincenz >
basically a tranformation framewor
04:50
<
vincenz >
though theoretically you could transform and transform until you have assembly
04:51
<
vincenz >
though stratego is not that efficient
04:51
<
vincenz >
nice thing is that you can easily make many small programs
04:51
<
vincenz >
and then just do
04:51
<
vincenz >
inputfile | transformation1 | transformation2| prettyprint
04:52
<
Nutssh >
Neat, but must be sluggish.
04:52
<
vincenz >
well nothing forces you to do it, you could always bundle transfos
04:52
<
Nutssh >
The.. I forget the compiler framework that rice uses works the same way.
04:52
<
vincenz >
but in case you 're testing things
04:53
<
vincenz >
it's a shame that there's so little out there for c++
04:53
<
vincenz >
another thing which I haven't figured out yet
04:53
<
vincenz >
is how to output only the code from the .cpp file
04:54
<
vincenz >
without all the crap from the headers
04:54
<
vincenz >
make that .cpp files
04:54
* vincenz
feels a bit lost :/
04:54
<
vincenz >
if only I could do a simple lang like java or so
04:54
<
vincenz >
no preprocessor crap, no unparseable language
04:54
<
Nutssh >
What does a google for C++ parsers give you? Or can you use G++ as a front end?
04:55
<
vincenz >
Nutssh: no g++ flattens too much
04:55
<
vincenz >
google for c++ parsers gives you many parsers (for instance xml) written in c++
04:55
* vincenz
tries clusty
04:56
<
vincenz >
I might try this question here, as c++ is a big channel full of newbies
04:57
<
vincenz >
do you know whom to contact about changes to the c++-standard?
04:57
<
Nutssh >
Can you undo the flattening? Do downstream tools care
*that* much?
04:57
<
vincenz >
Nutssh: yes
04:57
<
vincenz >
many of these tools are exploratory tools
04:57
<
vincenz >
me printing unreadable code isn't going to help the developers much
04:58
vezenchio has quit [Read error: 110 (Connection timed out)]
05:00
<
Nutssh >
Try googling for 'c++ parsing' I found, eg, TENDRA.
05:01
<
vincenz >
btw what do you do again?
05:01
<
Nutssh >
Computer security, but I like to play a formal languages guy in my spare time.
05:02
<
Nutssh >
Buy a parsing front end. Maybe kai as a C++ --> C translater?
05:03
<
Demitar >
vincenz, you want to change the c++-standard? :)
05:08
<
vincenz >
I placed a post on comp.std.c++
05:12
<
vincenz >
there's somtehing that imho is lacking
05:14
pango has quit [tolkien.freenode.net irc.freenode.net]
05:14
Godeke has quit [tolkien.freenode.net irc.freenode.net]
05:14
Smerdyakov has quit [tolkien.freenode.net irc.freenode.net]
05:14
skylan has quit [tolkien.freenode.net irc.freenode.net]
05:14
judge has quit [tolkien.freenode.net irc.freenode.net]
05:14
Demitar has quit [tolkien.freenode.net irc.freenode.net]
05:14
mattam has quit [tolkien.freenode.net irc.freenode.net]
05:14
zigong_ has quit [tolkien.freenode.net irc.freenode.net]
05:14
cmeme has quit [tolkien.freenode.net irc.freenode.net]
05:14
mrvn has quit [tolkien.freenode.net irc.freenode.net]
05:14
async has quit [tolkien.freenode.net irc.freenode.net]
05:14
pharx has quit [tolkien.freenode.net irc.freenode.net]
05:15
zigong_ has joined #ocaml
05:15
Smerdyakov has joined #ocaml
05:15
pango has joined #ocaml
05:15
cmeme has joined #ocaml
05:15
mrvn has joined #ocaml
05:15
async has joined #ocaml
05:15
skylan has joined #ocaml
05:15
Godeke has joined #ocaml
05:15
judge has joined #ocaml
05:15
Demitar has joined #ocaml
05:15
mattam has joined #ocaml
05:15
pharx has joined #ocaml
05:15
pango has quit [tolkien.freenode.net irc.freenode.net]
05:15
Godeke has quit [tolkien.freenode.net irc.freenode.net]
05:15
Smerdyakov has quit [tolkien.freenode.net irc.freenode.net]
05:15
mattam has quit [tolkien.freenode.net irc.freenode.net]
05:15
skylan has quit [tolkien.freenode.net irc.freenode.net]
05:15
Demitar has quit [tolkien.freenode.net irc.freenode.net]
05:15
judge has quit [tolkien.freenode.net irc.freenode.net]
05:15
async has quit [tolkien.freenode.net irc.freenode.net]
05:15
mrvn has quit [tolkien.freenode.net irc.freenode.net]
05:15
cmeme has quit [tolkien.freenode.net irc.freenode.net]
05:15
zigong_ has quit [tolkien.freenode.net irc.freenode.net]
05:15
pharx has quit [tolkien.freenode.net irc.freenode.net]
05:16
lus|wazz has quit [Read error: 110 (Connection timed out)]
05:16
zigong_ has joined #ocaml
05:16
Smerdyakov has joined #ocaml
05:16
pango has joined #ocaml
05:16
cmeme has joined #ocaml
05:16
mrvn has joined #ocaml
05:16
async has joined #ocaml
05:16
skylan has joined #ocaml
05:16
Godeke has joined #ocaml
05:16
judge has joined #ocaml
05:16
Demitar has joined #ocaml
05:16
mattam has joined #ocaml
05:16
pharx has joined #ocaml
05:28
vezenchio has joined #ocaml
05:52
mrsolo has joined #ocaml
05:52
mrsolo has quit [Client Quit]
05:53
mrsolo has joined #ocaml
05:55
Ulianov has joined #ocaml
06:46
Ulianov has quit []
08:17
mlh has joined #ocaml
09:36
mrsolo_ has joined #ocaml
09:36
cmeme has quit ["Client terminated by server"]
09:37
cmeme has joined #ocaml
09:53
mrsolo has quit [Read error: 110 (Connection timed out)]
10:17
zigong has joined #ocaml
10:18
zigong_ has quit [Read error: 110 (Connection timed out)]
11:51
mrvn_ has joined #ocaml
12:02
mrvn has quit [Read error: 110 (Connection timed out)]
12:10
skyrace has joined #ocaml
12:10
skyrace has left #ocaml []
12:30
mlh has quit [Client Quit]
12:53
srv has joined #ocaml
12:53
srv_ has quit [Read error: 232 (Connection reset by peer)]
12:55
zigong has quit [Read error: 110 (Connection timed out)]
12:58
zigong has joined #ocaml
13:30
menace has joined #ocaml
14:07
_fab has quit [Remote closed the connection]
14:11
menace has left #ocaml []
14:12
goooomba has quit [Read error: 104 (Connection reset by peer)]
14:17
Maldoror has quit [Read error: 54 (Connection reset by peer)]
14:19
Maldoror has joined #ocaml
14:24
_fab has joined #ocaml
14:30
Submarine has joined #ocaml
14:40
<
Submarine >
45129.11user 8.11system 12:32:34 <-- minor heap size = 32k (default)
14:40
<
Submarine >
33468.41user 12.11system 9:18:26 <-- minor heap size = 1000k
14:41
<
Submarine >
26% off - enormous
14:57
budjet has joined #ocaml
15:01
vezenchio has quit ["Deadpool still votes for Perot. Every time. Just in case."]
15:36
budjet has quit [Remote closed the connection]
15:42
Submarine has quit ["Leaving"]
15:43
zigong has quit [Remote closed the connection]
15:54
Maldoror has quit ["Leaving"]
16:26
_fab has joined #ocaml
16:39
GreyLensman has joined #ocaml
16:51
cjohnson has quit [Read error: 238 (Connection timed out)]
18:12
pango has quit [Nick collision from services.]
18:12
pango has joined #ocaml
19:20
ianxek has joined #ocaml
20:14
<
drz >
what do I call to print an arbitrary value, like the debugger does?
21:44
terpstra has joined #ocaml
21:44
<
terpstra >
good evening!
21:46
<
terpstra >
I was wondering if anyone knows how to make ocaml swallow multiple module definitions. I want the most recent definite to override older one; similar to rebinding with let
21:49
<
Demitar >
terpstra, and your problem is?
21:49
<
terpstra >
Demitar, ... it doesn't seem to be possible.
21:50
<
terpstra >
'module A = ....; module A = ....;'
21:50
<
Demitar >
drz, check the mailing list. It has been discussed back and forth recently.
21:50
<
terpstra >
-> 'Multiple definition of the module name Multiplication.'
21:50
<
terpstra >
or A in the above example
21:51
<
terpstra >
I want to do this inside a signature; I am trying to add aditional restrictions on a nested module
21:52
<
terpstra >
module type Ring = sig ...lots of stuff... module Multiplication : Monoid end
21:52
<
Demitar >
Why not use module Foo = (struct ... end : sig end) ?
21:52
<
terpstra >
module type Field = sig include Ring ... more stuff ... module Multiplication : Group end
21:52
<
Smerdyakov >
Clearly it makes no sense to define a module twice inside a signature.
21:52
<
terpstra >
I want to say that in a Field, the nested module Multiplication must also be a Group
21:52
<
terpstra >
Smerdyakov, I think in the above example it does make sense
21:53
<
Demitar >
Something like a class implementing multiple interfaces?
21:53
<
Smerdyakov >
You are shadowing a definition from an old signature, not defining it twice.
21:53
<
terpstra >
Smerdyakov, the 'include' redefines it, so when i define it again -- it amounts to the same error as defining it twice
21:54
<
terpstra >
Demitar, it's not multiple inheritence -- what i want it to restrict the interface further by requiring a stricter signature on a nested module
21:54
<
Demitar >
Why not define the least common denominator and then include that?
21:54
<
terpstra >
Demitar, that's what i do at the moment
21:54
<
terpstra >
however, i wanted to know if there's a way to clean this up
21:55
<
Smerdyakov >
terpstra, oh, I see the problem.
21:55
<
terpstra >
if you know abstract algebra, you'll recognize that there is an increasing tower of types
21:55
<
terpstra >
each adding more definitions and more restrictions
21:55
<
Smerdyakov >
terpstra, perhaps you can modify the signature you include, using 'where type' or whatever the OCaml version of that is.
21:55
<
terpstra >
for each layer, right now i have to introduce the new definitions (without the modules) in one branch of module types
21:56
<
terpstra >
Smerdyakov, there is 'where type = type-expr' and 'where module = module-expr' according to the grammar
21:56
<
terpstra >
neither do what i need -- they are for saying these two types or modules must be equal
21:56
<
terpstra >
they don't allow you to restrict the signature further
21:56
<
Smerdyakov >
'where type'
21:57
<
Smerdyakov >
restricts signatures.
21:57
<
Smerdyakov >
Perhaps not in the way you need, but that's what it does.
21:57
<
terpstra >
Smerdyakov, as i understand where type t = x, that says that in the signature, type t must
_exactly_ equal x
21:58
<
Smerdyakov >
Right, which makes for a more restrictive signature.
21:58
<
terpstra >
Smerdyakov, and where module y = x means again, exact equality
21:58
<
terpstra >
Smerdyakov, If there was a 'where module y : somesig' -- that would work
21:58
<
terpstra >
but i don't see it in ocaml's grammar =)
21:59
<
terpstra >
another way of acheiving the same thing would be if ocaml let me rebind modules, the way you can rebind variables
21:59
<
terpstra >
... it seems inconsistent that ocaml can't do this
22:05
<
Demitar >
I'm sure caml-list can answer your question if nothing else. :)
22:06
Hipo has quit [Read error: 232 (Connection reset by peer)]
22:06
Hipo has joined #ocaml
22:06
<
terpstra >
Demitar, what is the address of caml-list?
22:07
<
terpstra >
inria.fr
22:07
<
terpstra >
ok - thanks =)
23:03
vezenchio has joined #ocaml
23:42
kinners has joined #ocaml