<bernardofpc>
gasche> there is no tool that can check if a given piece of code is actually a valid C program -> Is it true for OCaml ?
<bernardofpc>
(my guess is that implies not-Turing Completeness, so it cannot be the case for OCaml)
jcao219_ has quit [Ping timeout: 264 seconds]
eikke has joined #ocaml
Drup has quit [Quit: Leaving.]
<orbitz>
bernardofpc: I don't think it is true
darkf has joined #ocaml
eikke has quit [Ping timeout: 255 seconds]
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
jbrown has quit [Ping timeout: 248 seconds]
dsheets has quit [Read error: Operation timed out]
Watcher7 is now known as Watcher7|off
Watcher7|off is now known as Watcher7
q66 has quit [Remote host closed the connection]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
ben_zen has quit [Ping timeout: 276 seconds]
ben_zen has joined #ocaml
ontologiae has joined #ocaml
<SuperNoeMan>
is it true that the ocaml compiler can sometimes introduce code that is concurrent (able to use more than core simultaneously) that is provably harmless?
emmanuel__ has quit [Ping timeout: 245 seconds]
ontologiae has quit [Ping timeout: 240 seconds]
osnr has quit [Quit: Leaving.]
talzeus has joined #ocaml
ggole has joined #ocaml
weie has joined #ocaml
weie_ has quit [Ping timeout: 248 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
weie has quit [Read error: Connection reset by peer]
weie has joined #ocaml
osnr has quit [Ping timeout: 248 seconds]
jcao219 has joined #ocaml
gautamc has quit [Ping timeout: 245 seconds]
gautamc has joined #ocaml
<darkf>
SuperNoeMan: you mean parallel? i don't know if it does but in theory it could (and i believe some versions of haskell do)
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<gasche>
bernardofpc: provided you avoid C bindings and Obj, yes, OCaml programs have a well-defined semantics
<gasche>
(of course I mean programs that pass the type-checker)
<gasche>
there are some parts that are unspecified, such as evaluation order of constructor arguments
<gasche>
but no "undefined behavior" in the C sense
gautamc has quit [Read error: Connection reset by peer]
<adrien>
SuperNoeMan: if the code doesn't allocate, yes
<adrien>
but at the same time, the thread switching happens when a thread wants to allocate
gautamc has joined #ocaml
ttamttam has joined #ocaml
Yoric has joined #ocaml
jcao219 has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
eni has joined #ocaml
Kakadu has joined #ocaml
ttamttam has quit [Quit: ttamttam]
Watcher7 is now known as Watcher7|off
deavidsedice has joined #ocaml
BiDOrD_ has joined #ocaml
orbitz_ has joined #ocaml
pr_ has joined #ocaml
contempt has quit [Disconnected by services]
contempt has joined #ocaml
f[x] has joined #ocaml
rgrinberg1 has joined #ocaml
rgrinberg has quit [Ping timeout: 276 seconds]
ygrek has quit [Ping timeout: 276 seconds]
orbitz has quit [Ping timeout: 276 seconds]
pippijn_ has quit [Ping timeout: 276 seconds]
pr has quit [Ping timeout: 276 seconds]
BiDOrD has quit [Ping timeout: 276 seconds]
tlockney has quit [Ping timeout: 276 seconds]
deavid has quit [Ping timeout: 276 seconds]
tlockney has joined #ocaml
pippijn has joined #ocaml
jbrown has joined #ocaml
Snark has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
jpdeplaix` has quit [Ping timeout: 248 seconds]
jpdeplaix has joined #ocaml
eni has quit [Ping timeout: 248 seconds]
ollehar has joined #ocaml
ulfdoz has joined #ocaml
ben_zen_ has joined #ocaml
eni has joined #ocaml
ben_zen has quit [Ping timeout: 264 seconds]
testcocoon has joined #ocaml
zpe has joined #ocaml
yacks has quit [Ping timeout: 264 seconds]
zpe has quit [Ping timeout: 252 seconds]
Yoric has quit [Ping timeout: 256 seconds]
Kakadu has quit [Ping timeout: 245 seconds]
Drup has joined #ocaml
ben_zen_ has quit [Ping timeout: 264 seconds]
<gasche>
no actually-used functional language that I know of do automatic parallelization; neither OCaml nor Haskell
<gasche>
it's simply too costly to over-parallelize, and automatic heuristics are not good enough for general programs
y has joined #ocaml
y is now known as Guest1066
mcclurmc has joined #ocaml
f[x] has quit [Ping timeout: 255 seconds]
<Drup>
gasche: isn't there the "par" operator in haskell that's almost like magic parallelization ?
<jpdeplaix>
Drup: why ? It's simple. You evaluate the first argument in parallel with the second :/
<Drup>
jpdeplaix: AFAIK, you don't specify anything except "do stuff in parallel".
<ollehar>
two modules implements the same signature, but I can't have both it's types in a list (although they are the same). can I downcast a type from a module to its included module?
Guest1066 has quit [Ping timeout: 276 seconds]
<flux>
ollehar, well, if you could simply put them into the same list it would mean you would be able to use other module's operations on the other module's values
<flux>
ollehar, you probably want to use the shiny newish first class module support
<flux>
and put the module along the value
<ollehar>
I'll try that
<ggole>
gasche: SQL doesn't count?
<ggole>
(Mind you, it has the considerable advantage of being able to safely assume that operations are heavyweight.)
<bernardofpc>
agasche> | bernardofpc: provided you avoid -> can't you program in (idiomatic, of course) C avoiding those undefined behaviours, thus being also compile-time validatable ?
ttamttam has joined #ocaml
Fnar has joined #ocaml
ulfdoz has quit [Ping timeout: 246 seconds]
<ollehar>
flux: but now there's nothing to stop me from using functions from M1 on M2. is that the price to pay if I'll want to have them in the same list?
jayprich has joined #ocaml
<gasche>
ggole: interesting remark; I hadn't considered SQL, as I implicitly considered general-purpose languages
<gasche>
Drup: the point is that no *automatic* parallelization is done
<gasche>
and as most Haskell programmers will tell you, adding `par` everywhere usually slows down the code
<gasche>
ollehar: do you want to preserve the fact that M1.t and M2.t are different types?
<gasche>
if yes, then why do you want to have both in a list (what would you do with the elements?)
<ollehar>
yes, but the same subtype.
<gasche>
if no, then why is it problematic to put them in a list together?
<gasche>
what is a subtype in this context?
<gasche>
there is subtyping at the module level, but it does not imply subtyping at the type level
<gasche>
bernardofpc: no, in idiomatic C it is not decidable whether a given piece of code is defined or not
<gasche>
you can statically rule out Obj, extern and, say, unsafe_get from OCaml programs, and have a useful language
<gasche>
you can hardly rule out pointer access from C
<Drup>
gasche: Ok, I misunderstood the "automatic" part.
<gasche>
or those integer overflows that are undefined
<gasche>
it is a research topic to develop static analyzers that could catch undefined behavior and still be useful
<gasche>
even catching them *dynamically* is not an established practice (I believe most of the tools are now in place to do that, but I'm not aware of a convenient combination of them)
<gasche>
hm
<gasche>
in fact I'm not sure all of them can be detected dynamically (aliasing restrictions can have fairly non-local constraints)
<gasche>
ollehar: do you have a realistic code example of what you're trying to achieve?
<gasche>
(I think the solution may be a private type abbreviation)
<ollehar>
yeah, from what we were talking about yesterday, about tutorial, I figured I would transcribe a chapter from a book about Java to OCaml, using the OCaml module system.
<ollehar>
so OO polymorphism
<gasche>
I'm not sure it's actually a good idea to use the module system at this granularity, but why not
<gasche>
you should put your code example somewhee
<ollehar>
yep, drup had a look at it yesterday, I might pastebin again, but right now it's pretty much code
<ollehar>
also, there's to approaches: include a module in another module, and use a functor. could be interesting to highlight both and discuss pros and cons.
<ollehar>
*two
<ollehar>
*or use
<gasche>
wmeyer``: what's the difference between ocamlbuild/test and ocamlbuild/testsuite ?
<bernardofpc>
gasche> | bernardofpc: no, in idiomatic C it is not decidable whether a given piece of code is defined or not -> do you have an example of what you mean, and something in OCaml's syntax/language/i don't know/ that excludes this ?
<bernardofpc>
(not sure you meant "defined" by "pointer access" or something different, and even in that cas, what you mean)
zpe has joined #ocaml
jayprich has quit [Quit: jayprich]
bacam_ is now known as bacam
Kakadu has joined #ocaml
<ollehar>
Here's an example using 'include module Student'
<ollehar>
problem is at line 74, where one can use both modules for either type.
Guest1066 has joined #ocaml
yacks has joined #ocaml
<Drup>
Hum, I was a bit too tired to notice the patern yesterday but, you should do that with objects.
<Drup>
this is far better suited for the job
eikke has joined #ocaml
<Drup>
(of course, your code will compile if you replace UndergraduateStudent.to_string by GraduateStudent.to_string)
<ollehar>
no, the this is it DOES compile
<ollehar>
but it "shouldn't"
<ollehar>
*thing
osnr has quit [Quit: Leaving.]
q66 has joined #ocaml
<wmeyer``>
gasche: test/ is the old testsuite, based on shell scripts and makefiles, where is testsuite/ is a new testsuite based on OCaml
<wmeyer``>
we should run both, but I don't develop actively test/
ttamttam has quit [Quit: ttamttam]
<wmeyer``>
feel free to add any tests to testsuite/level0.ml (I grouped them into separate files, so far there is only level0; to run them just say ocaml level0.ml)
Kakadu_ has joined #ocaml
Kakadu has quit [Read error: Connection reset by peer]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
emmanuelux has joined #ocaml
ontologiae has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
mcclurmc has quit [Ping timeout: 246 seconds]
<gasche>
wmeyer``: thanks for the info
<gasche>
bernardofpc: I'm talking about the notion of "undefined behavior" as used in the C standard
<gasche>
the "valid" C programs are those that are defined
<gasche>
(meaning all their operations are defined)
eikke has quit [Ping timeout: 246 seconds]
<gasche>
if you pass to a C compiler a source code that is not a valid C program, running it may do anything
<gasche>
(running the compiled program)
<gasche>
it may not do anything at all, for example, or do something completely different from what you expected
<bernardofpc>
like dereferencing invalid pointers ?
<gasche>
yes
<gasche>
or indexing an array outside its bound
<bernardofpc>
that's the same ;-)
<gasche>
(or even computing the adress of an element outside the bounds)
<gasche>
well arrays and pointers are different notions in C
<gasche>
another example is
<bernardofpc>
(you mean &(v[Too_big]) ??? I guess this is just v+TooBig by definition)
<gasche>
(*p = 1) + (*q = 2);
<gasche>
which is undefined if p and q alias
<gasche>
bernardofpc: v+TooBig causes undefined behavior if TooBig is not in the bounds of the array
<bernardofpc>
not sure that v+TooBig is undefined, my guess is that pointer arithmetic is integer + shift arithmetic
<bernardofpc>
if you modify its contents, then those contents get modified
<gasche>
I am sure that v+TooBig is undefined
<bernardofpc>
you mean just computing the address ?
<gasche>
yes
<bernardofpc>
surprising
<gasche>
signed integer overflow is also an undefined behavior
<gasche>
(unsigned isn't)
<gasche>
ollehar: you need more type abstraction
<gasche>
module GraduateStudent = struct type student = private Student.student include (Student with student = student) ... end
<gasche>
hm
<gasche>
disregard that line, private in the structure won't work, it needs to be in the signature
<gasche>
module GraduateStudent : sig type student = private Student.student include (STUDENT with student = student) ... end = struct include Student ... end
<gasche>
also ollehar, it would be better if your examples did not have that much code duplication
<gasche>
(eg. between Graduate and Undergraduate)
<gasche>
bernardofpc: you'll notice that most C programmers have no clue whether the program they wrote is actually a well-defined program
ulfdoz has joined #ocaml
<ggole>
Tons of stuff is undefined in C
<gasche>
the situation is very different from the OCaml world
<gasche>
in OCaml, if you introduce a bug in your program, it will have a meaning that is different from the one you expect
<gasche>
in C, quite often it will have *no meaning at all*
<ggole>
x / 0, x / -1 where x = INT_MIN, for instance
<ggole>
Or shift by word-size - 1 or more
<gasche>
OCaml's type system is meant to guarantee that only well-defined programs are executed
<gasche>
(of course Obj and stuff are there to provide an escape hatch)
<gasche>
C's type system is vastly under-powered for this
<ggole>
Or shift by negative amounts (in various circumstances)
<ggole>
And that's just ints
<ggole>
The problem is exacerbated by people who say "no, it's fine, the compiler won't able to tell" and proceed to write junk code.
<gasche>
ggole: and also choices of the language and compiler designers to sacrifice sanity and common practice for the benefits of performance at all costs
<ggole>
Performance at all costs is ok if you have a sane model.
<gasche>
well
<ggole>
Various machine languages are quite comprehensible, for instance.
<ggole>
With very little undefined behaviour.
<ollehar>
gasche: yes, now it works. very nice!
<gasche>
indeed
<gasche>
as one says, "Sometimes the society changes the law, sometimes the law changes the society"
<ousado>
ATS is a good example for a very performance-oriented design
<gasche>
your remark about uncareful programmers is about the society not respecting the law
<ousado>
+ a ver correctness-oriented design
<ousado>
*very
<gasche>
I believe that the C law also lacks respect for its society
<gasche>
not defining the 2-complement model for signed computations for example is harmful
<gasche>
because it's what people have always used and assumed
<ggole>
That was more of a concern forty years ago, but yes.
<gasche>
how so?
<gasche>
ah you mean portability
<ggole>
(I believe C was actually ported to some one-complement architectures)
<gasche>
well
<ggole>
But that was way back in the stone ages when people computed by bashing rocks together
<gasche>
they could avoid the undefined behavior and remain portable
<gasche>
with a list of options and implementation-specified behavior
<ggole>
Two's complement is a very reasonable assumption today.
<gasche>
wmeyer``: is there no makefile support for running the ocamlbuild tests?
<gasche>
I would expect a "make test"
<ggole>
Yes, they could... it is another question whether the language could be successfully changed at this point
yacks has quit [Quit: Leaving]
dsheets has joined #ocaml
<ggole>
And I don't think the performance impact would be large. In fact I wonder whether it would be measurable.
<ggole>
(With the exception of certain things like bounds checks.)
<gasche>
in any case, I laugh at people claiming that C is a "simple" language
<ggole>
Yeah.
<ousado>
as with Java, what can make a difference for C is strong tool/static analysis support, e.g. the clang approach
<ggole>
Ritchie's original language, maybe.
<ggole>
Not the mess we have now.
<gasche>
ousado: in other words, some ad-hoc form of type system
<ousado>
yes
<wmeyer``>
gasche: for the testsuite it's something that has to be done. Before the days we didn't have the CI, it was not strictly needed, but you are right, we have to implement it now.
<gasche>
wmeyer``: well I don't know how to run the testsuite, and a target would have helped :p
<gasche>
if you can right now write a 5-line patch for this, that would be welcome
<wmeyer``>
gasche: just feed the level0.ml to ocaml :-)
<gasche>
otherwise I'm in the process of finding out
<gasche>
I get that part
<gasche>
but test/ complains about figlet and what not
<gasche>
(plus it asks for ocamlbuild.native which I hadn't built)
<ggole>
Static analysis gets pretty hard when x + 1 could be undefined behaviour.
<wmeyer``>
oh test/ ... i tried to fix them, they very rusty, i am not sure if they still work
<gasche>
ggole: but runtime instrumentation handles this well
<ggole>
Or has the state of the art improved so much that interprocedural value analysis can be done effectively now?
<gasche>
I'm more worried about aliasing constraints
<ggole>
Yes, there's an interesting undefined behaviour checker out there.
<ggole>
The name escapes me for the moment.
<gasche>
there are several
<wmeyer``>
gasche: ok, i will try to put them into the right shape now
<gasche>
John Regehr has an overflow checker
<gasche>
the Maude people have their rewriting semantics for C
<gasche>
(but it is a bit overspecified I believe)
<ggole>
That's probably the one I was thinking of
<gasche>
the frama-C people have an executable semantics as well
<ggole>
So one question is how to get "real" C developers to care about such tools.
<gasche>
more generally, I think static analysis is undervalued in the open-source world
<ggole>
People seem willing to use Valgrind.
<gasche>
windows kernel developers seem more receptive than most floss places
<ggole>
Perhaps there's some hope there.
<gasche>
Mozilla has been doing nice thing as well
<Drup>
gasche: did someone tried to compile the kernel with compcert ?
<gasche>
and google use Clang to do analysis, but I suppose most stay in-house and the culture doesn't transfer that easily
<gasche>
Drup: Compcert doesn't handle enough
<ggole>
They write their own passes?
<Drup>
yeah, that's understandable
<gasche>
ggole: I believe so
<ggole>
Hmm, I wonder how specific that work is.
<gasche>
Drup: besides, Compcert accepts programs that are undefined
<gasche>
it gives meaning to more programs than the C standard
<ggole>
It would have to, to compile the Linux kernel.
<Drup>
why is that ?
<gasche>
Drup: well
<gasche>
it fixes an evaluation order, for example
<gasche>
which makes some programs defined that wouldn't be for other ordering choices
<ggole>
And there are many common extensions.
<ggole>
Nobody really programs in standard C.
<gasche>
Drup: if you're interested, Gagallium blogged about that!
<ggole>
There's a great rant about C not existing by one of the analysis tools people (Coverity?)
<Drup>
that's sounds more like a good thing to my hears to have a fix evaluation order !
<Drup>
gasche: hum, I usually follow the ocaml planet rss feed, I must have miss this one, thanks !
<gasche>
it's quite technical
mcclurmc has joined #ocaml
eikke has joined #ocaml
eni has quit [Ping timeout: 245 seconds]
mcclurmc has quit [Ping timeout: 255 seconds]
jcao219 has joined #ocaml
mcclurmc has joined #ocaml
hto has joined #ocaml
eikke has quit [Ping timeout: 246 seconds]
mcclurmc has quit [Ping timeout: 255 seconds]
ulfdoz has quit [Ping timeout: 255 seconds]
ulfdoz has joined #ocaml
Guest1066 has quit [Ping timeout: 264 seconds]
eni has joined #ocaml
zpe has joined #ocaml
zpe_ has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
zpe_ has quit [Ping timeout: 245 seconds]
spanish has joined #ocaml
<spanish>
hi
jcao219 has quit [Ping timeout: 264 seconds]
eni has quit [Ping timeout: 264 seconds]
eikke has joined #ocaml
tobiasBora has joined #ocaml
Tobu_ has quit [Remote host closed the connection]
Tobu has joined #ocaml
mcclurmc has joined #ocaml
<wmeyer``>
hi spanish
Yoric has joined #ocaml
tobiasBora has quit [Ping timeout: 248 seconds]
tobiasBora has joined #ocaml
talzeus has quit [Remote host closed the connection]
emmanuelux has quit [Quit: emmanuelux]
jbrown has quit [Read error: Operation timed out]
Yoric has quit [Ping timeout: 252 seconds]
emmanuelux has joined #ocaml
pootler_ has joined #ocaml
pootler_ has quit [Client Quit]
pootler_ has joined #ocaml
ontologiae has quit [Ping timeout: 245 seconds]
<spanish>
ups, hi wmeyer``
Kakadu_ has quit []
<spanish>
didn't hear the beep
ben_zen has joined #ocaml
eikke has quit [Ping timeout: 276 seconds]
jbrown has joined #ocaml
Guest1066 has joined #ocaml
oriba has joined #ocaml
<ollehar>
would it be possible to make a value out of a phantom type?
eikke has joined #ocaml
<gasche>
ollehar: I'm not sure what you mean
<gasche>
do you have a concrete example?
<ollehar>
soon
<ollehar>
continuing my lua example, it's possible to call lua from ocaml by first pushing the function name on the stack, then the arguments, then call "pcall i", where "i" is the number of args on stack. now, while pushing args on the stack, the phantom type representing the stack will grow in size. can I in some way get out the size of the phantom type stack and feed it to pcall?
<gasche>
you can't, but you can make your type less phantom
<gasche>
we say "phantom" because they don't hold any runtime value
<gasche>
it appears that you want to hold some information, after all; at least an integer
<gasche>
(in the most general case you can keep things that are essentially runtime-type-information corresponding to the previously-phantom type parameters)
<ollehar>
but I can pop the stack with:
<ollehar>
val pop : ('a, 'b * 'c) t -> ('b, 'c) t
<ollehar>
Can't I just pop the stack a number of times and counts the pops?
<gasche>
I'm not sure what you mean
<gasche>
do you expect the type-checker to somehow count the larger number of repeated applications that would make the type-checking succeed, and turn that into a constant integer?
<gasche>
my suggestion is to have ('a, 'b * 'c) t contain an integer that would be incremented by push and decremented by pop
darkf has quit [Quit: Leaving]
<ollehar>
(int, 'b, 'c)?
<ollehar>
sorry, (int, 'b * 'c)
<gasche>
not in the visible type parameters
<gasche>
in the implementation of t
<gasche>
instead of
<gasche>
type (_, _) t = lua_state
<gasche>
you'd have e.g.
<gasche>
type (_, _) t = { stack_size : int; state : lua_state }
<gasche>
if in the future you have more needs, you could add some stuff here
<gasche>
eg. instead of just the stack size, keep a "stack" field with static information about each argument you pushed
<gasche>
or whatever
Guest1066 has quit [Ping timeout: 264 seconds]
<gasche>
well it may even be
ontologiae has joined #ocaml
<gasche>
type (_, _) t = data * lua_state and data = Array of ... | Stack of ...
gal_bolle has joined #ocaml
<ollehar>
but if it's possible to make type level peano numbers into an int, wouldn't it be possible to do the same with a phantom stack?
<gasche>
you can't make a type level peano number into an int
<gasche>
you need a dynamic representation of the number
<gasche>
the GADT trick precisely establishes a link between a runtime value and a static type
<gasche>
ollehar: type information does not exist anymore at runtime
<gasche>
that's something very basic about how reasonable programming languages do things
pootler_ has quit [Ping timeout: 276 seconds]
<gasche>
(ok, that was trolling; let's say "motivated programming languages")
yacks has joined #ocaml
<ollehar>
ah, of course
<spanish>
is there any action one can take on lexers to ignore a match?
<spanish>
forgot this: let unsigned_int = ['0'-'9']+
<spanish>
and what I'm trying is to discard that match. That is, the lexer sees it, I parse it, so already have the information I wanted, and if possible remove it as if it never existed
<spanish>
don't know if that's the correct approach, as I yet don't understand the lexer
ttamttam has joined #ocaml
tobiasBora has quit [Quit: Konversation terminated!]
bkpt has quit [Quit: Leaving]
bkpt has joined #ocaml
bkpt has quit [Quit: Leaving]
bkpt has joined #ocaml
avsm has left #ocaml []
avsm has joined #ocaml
oriba_ has joined #ocaml
<gasche>
spanish: look at your parser definition, it is surely done elsewhere
<gasche>
in fact I believe that what is parsed by a lexing rule is immediately discarded from the input stream of chars
<gasche>
so I'm not sure what to make of your question, but I suspect what you actually want to do is to lex the remaining to send an output
<gasche>
and in that case the syntax is "<name of the lexing rule being define> lexbuf"
oriba has quit [Ping timeout: 248 seconds]
<gasche>
eg. (token lexbuf) if you are under "rule token = parse ..."
<gasche>
but the good news, for you, is that the OCaml lexer already implements lexing directives
<gasche>
and you should be able to imitate that code quite closely
<gasche>
(what is parsed is the syntax of OCaml's lexer directives, but I believe they are identical, or a superset of, cpp's lexer directives)
gautamc has quit [Read error: Connection reset by peer]
ttamttam has left #ocaml []
gautamc has joined #ocaml
ulfdoz has quit [Quit: deprecated]
ulfdoz has joined #ocaml
pootler_ has joined #ocaml
ggole has quit []
ulfdoz has quit [Ping timeout: 264 seconds]
pootler_ has quit [Ping timeout: 245 seconds]
mattrepl has quit [Quit: mattrepl]
<spanish>
thanks, yes, I've seen that sort of constructions on the manual
<spanish>
being for a while looking for mk_token and other, which happened to be on the same lexer file, but
wmeyer has joined #ocaml
<spanish>
can't really get the lexer to remove it from the input so it doesn't get to the parser yet
<spanish>
still struggling with it
<spanish>
still I haven't seen any "void" rule
<spanish>
which is to say, a rule that consumes input and leaves nothing to the parser
<spanish>
but yes, looks close to cpp's output
<spanish>
I wasn't too far with my string catching regex after all, thought it was too dirty in first place, though
<gasche>
spanish: you cannot have a "void" rule
<spanish>
well, one might, no?
<spanish>
not everything needs to get to the parser
<gasche>
the semantics of "rule <foo> = parse ..." is that it will desugar to a function that consumes an arbitrary number of input characters to produce the next token
<gasche>
that's the rule of the game
<gasche>
you call the <foo> function, it produces a token
<gasche>
no notion of "nope, nothing for now, call me again and you may have more"
<spanish>
yes, but what if you don't want to return a token?
<spanish>
oh
<gasche>
what you do is that you call the rule again, recursively
<gasche>
and let it produce a token
<spanish>
a ok, that makes sense
<gasche>
as I have explained before (maybe not in a clear enough way)
<gasche>
look at the code I pointed out on github
<gasche>
what it does is
<gasche>
<change the global mutable variable representing location information>; token lexbuf
<gasche>
which recursively calls the lexer on the same input (lexbuf) to produce a token
<spanish>
I see now, 'token lexbux'
<spanish>
yes, that makes sense, I'll try that
mattrepl has joined #ocaml
<spanish>
yeah thanks!, works like a charm
ben_zen has quit [Ping timeout: 240 seconds]
wmeyer has quit [Remote host closed the connection]
<ollehar>
anyone used the pa_monad syntax extension?
rgrinberg1 has quit [Quit: WeeChat 0.4.1]
rgrinberg has joined #ocaml
zbroyar has joined #ocaml
Snark has quit [Quit: leaving]
Guest1066 has joined #ocaml
ohama has quit [Remote host closed the connection]
<wmeyer``>
ollehar: me, and was a happy user before I switched to omonad.
Watcher7|off is now known as Watcher7
Guest1066 has quit [Ping timeout: 246 seconds]
spanish has quit [Quit: Leaving]
Guest1066 has joined #ocaml
pootler_ has joined #ocaml
fraggle_laptop has joined #ocaml
pootler_ has quit [Ping timeout: 252 seconds]
wmeyer`` has quit [Ping timeout: 256 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
zbroyar has left #ocaml []
gal_bolle has quit [Remote host closed the connection]
Guest1066 has quit [Ping timeout: 255 seconds]
tobiasBora has joined #ocaml
Watcher7 is now known as Watcher7|off
ohama has joined #ocaml
orbitz_ has quit [Ping timeout: 264 seconds]
bacam has quit [Ping timeout: 264 seconds]
skchrko has quit [Ping timeout: 264 seconds]
bacam has joined #ocaml
orbitz has joined #ocaml
skchrko has joined #ocaml
ben_zen has joined #ocaml
ben_zen has quit [Ping timeout: 276 seconds]
eikke has quit [Ping timeout: 240 seconds]
Watcher7|off is now known as Watcher7
noj_ has quit [Ping timeout: 248 seconds]
noj has joined #ocaml
pootler_ has joined #ocaml
pootler_ has quit [Ping timeout: 240 seconds]
ben_zen has joined #ocaml
osnr has quit [Quit: Leaving.]
ben_zen has quit [Ping timeout: 248 seconds]
mcclurmc has quit [Ping timeout: 255 seconds]
wmeyer has joined #ocaml
ontologiae has quit [Ping timeout: 240 seconds]
tobiasBora has quit [Quit: Konversation terminated!]