sponge45 changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
shawn_ has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
shawn has quit [Read error: 113 (No route to host)]
postalchris has quit [Read error: 110 (Connection timed out)]
Smerdyakov has quit ["Leaving"]
mnemonic has quit ["leaving"]
mikeX has quit ["leaving"]
zarvok has joined #ocaml
descender has joined #ocaml
david_koontz has quit ["This computer has gone to sleep"]
postalchris has joined #ocaml
postalchris has quit [Client Quit]
joshcryer has joined #ocaml
joshcryer_ has joined #ocaml
joshcryer has quit [Connection timed out]
joshcryer_ has quit [Client Quit]
pstickne has quit [Read error: 110 (Connection timed out)]
JeffSmac has joined #ocaml
JeffSmac has quit []
b00t has joined #ocaml
oscarh has quit [zelazny.freenode.net irc.freenode.net]
Hadaka has quit [zelazny.freenode.net irc.freenode.net]
oscarh has joined #ocaml
Hadaka has joined #ocaml
Submarine has joined #ocaml
oscarh has quit [zelazny.freenode.net irc.freenode.net]
Hadaka has quit [zelazny.freenode.net irc.freenode.net]
oscarh has joined #ocaml
Hadaka has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
oscarh has quit [zelazny.freenode.net irc.freenode.net]
Hadaka has quit [zelazny.freenode.net irc.freenode.net]
zarvok has quit ["BitchX-1.1-final -- just do it."]
oscarh has joined #ocaml
Naked has joined #ocaml
Naked is now known as Hadaka
benny_ has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
pants1 has quit [Connection timed out]
Submarine has quit ["Leaving"]
ramkrsna has quit ["Leaving"]
smimou has joined #ocaml
pstickne has joined #ocaml
pstickne has quit [Read error: 110 (Connection timed out)]
pstickne_ has joined #ocaml
shawn_ has quit ["This computer has gone to sleep"]
jlouis has quit [Remote closed the connection]
diffbavis has quit [Read error: 104 (Connection reset by peer)]
smimou has quit ["bli"]
shawn has joined #ocaml
david_koontz has joined #ocaml
shawn has quit [Read error: 110 (Connection timed out)]
b00t has quit [Remote closed the connection]
diffbavis has joined #ocaml
malc_ has joined #ocaml
david_koontz has quit ["Leaving"]
<vorago>
Uhm. I kind of don't understand error handling in ocaml(yacc+lex).
<fremo>
vorago: so do I... :)
<vorago>
;)
<fremo>
as far as I understood, it's the same than in the original yacc
<vorago>
Never touched original yacc. (-;
<vorago>
I've created function for displaying errors "parse_error s". in grammar file.
<fremo>
so, if I understood well, you can have a rule named "error" that match everything not matched...
<fremo>
hehe, that's cool :)
<vorago>
But I don't know how to pass it any error string from f. ex. lexer. ;-)
<vorago>
Hmhm. ;-)
<fremo>
well... :)
<vorago>
I guess I need another howto. ;-)
<fremo>
yea, if you have somes, I would be glad to know it
<vorago>
I can pass ERROR token with "string" semantic value. Catch it in grammar, printf value and raise exception.
<vorago>
But... it's...just not right.
<fremo>
yes, that's just ok for lexer errors
<vorago>
I'm reading currently standard Ocamlyacc Tutorial. Easy to find.
<fremo>
the one in the reference manual ?
<fremo>
from SooHyoung Oh ?
<fremo>
nice name BTW :)
<vorago>
yes the same. ;-)
<fremo>
so, that's it, just match errors with "error" and call your parse_error function... doesn't work ?
<vorago>
Hm. Can try this.
a-priori_ has quit [Read error: 110 (Connection timed out)]
malc_ has quit [Read error: 110 (Connection timed out)]
benny has joined #ocaml
yangsx has joined #ocaml
postalchris has joined #ocaml
shawn has joined #ocaml
zarvok has joined #ocaml
shawn_ has joined #ocaml
shawn has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
<vorago>
fremo, generally seems to work fine.
<vorago>
fremo, i've just added support for global variables. ;-)
<vorago>
Have to say: yacc+lex is real fun.
<fremo>
heh
<fremo>
yeah :)
<fremo>
do you do instantiation at the lexer stage ?
zarvok has quit ["BitchX-1.1-final -- just do it."]
johnnowak has joined #ocaml
phoniq has joined #ocaml
<vorago>
fremo, you mean? Like arythmetics?
<vorago>
In lexer i keep tracks of globals addresses. I will add there also a built-in function which will reserve there memory and return address for this.
<fremo>
dont you get just a semantic tree from the parser ?
<vorago>
Hm, I can show you this code in it's current stage if you like.
<vorago>
With yacc+lex i'm generating ASM code for virtual machine written in C.
<vorago>
You call "yacc" a parser? I was never sure how to call this stage.
<fremo>
yacc is parser generator :)
<vorago>
Ok. ;-) So naming goes as follows:
<vorago>
lex - lexer for parser generator
<vorago>
yacc - parser generator.
<vorago>
binary compiled using lex and yacc - compiler.
<fremo>
almost :)
<fremo>
lex is the lexer generator ;)
<vorago>
Hmhmhm, right.
<vorago>
;-)
<fremo>
for the parser generated by yacc :)
<vorago>
Hm... code compiled, by compiler is uhm. Code. ;p
<vorago>
output from compiler is assembler (here, actually)
<vorago>
output from assembler (meaning a program) is bytecode (here.)
<fremo>
and your compiler should be the program that use the lexer and the parser to generate the code (bytecode, whatever...)
<vorago>
Dreadful. ;-)
<vorago>
It's actually very simple. (main.ml) it just prints out parser output.
<fremo>
assembly source code ? :)
<vorago>
Hm, better name. In my language both are called "assembler".
<fremo>
heh :)
<vorago>
Parser calls functions from Generate.ml which return assembly.
<fremo>
ok, if that works... :)
<vorago>
It works.. but I'm unsure if there aren't better means of doing the same.;-)
<vorago>
It works, and is even quite clear.
yangsx has left #ocaml []
<fremo>
for example, I have an interpreter, it generate an instructions tree that I can execute...
<vorago>
I see.
<fremo>
I dont have intermediate file format or instruction set...
<vorago>
Well I started with writting virtual machine executing bytecode for my project.
<vorago>
In C. Then I thought i would be cool to write "higher level language" compiler for this.
<fremo>
yeah, I dont want to come back to C :)
<vorago>
I would like to be able to e.g. run code compiled with this on AVR microcontrollers.
<vorago>
Ocaml doesn't work on AVR. ;-)
<fremo>
ho, nice :)
<fremo>
yeah :)
<fremo>
you generate AVR assembly code ?
<flux->
coryou could port the byte code interpreter to avr.. that would be cool ;-)
<flux->
vorago, even
<fremo>
flux-: ho yes !
<fremo>
:)
<vorago>
flux-, i thought about it. I was even watching the stuff generating that code.
<vorago>
flux-, but my understanding of ocaml language is too little now. ;-/
<flux->
vorago, how much memory do you have?
<flux->
(in the avr)
<vorago>
Little.
<vorago>
4kb?
<flux->
4k?
<fremo>
bits or bytes ? :)
<flux->
I doubt the byte code interpreter will fit that..
<vorago>
And about 32 kb for code.
<vorago>
64 on biggest in DIP packaging.
<vorago>
128 in the biggest.
<vorago>
Well. Generally you can rewrite bytecode interpreter so it will store some data in the external RAM.
<fremo>
whahooo ! that's huge ! :o)
<vorago>
But it's not simple. ;-)
<flux->
on x86 ocamlrun is 123 kilos.
<flux->
but I guess the size could be brought down
<vorago>
Without libs.
<flux->
it's 32-bit, right?
<vorago>
AVR? No. 8-bit.
<vorago>
However I'm going to get interested in ARM. They are 16/32 bit.
<vorago>
It would be VERY possible to make it running on ARM.
<vorago>
ARM7TDMI. On ARM9TDMI even linux runs.
<flux->
that'd be cheating?-)
<flux->
but I suppose it'd be the easy solution
<flux->
what are you doing with the hardware?
<vorago>
I've got few small projects. Robot controller on AVR is the biggest actually.
<vorago>
fremo, and i'm not generating strict AVR code. But it's RISC. It wouldn't be so hard. It's an interesting idea. ;-)
<vorago>
fremo, I'm generating bytecode which could be run on AVR with small VM.
<vorago>
VM is about 700 C lines without assembler.
<vorago>
I need to learn ocaml better before trying something like this.
<vorago>
There are generally two options: bytecode interpretter ported to ARM, or ocaml to native AVR/ARM code compiler.
<vorago>
However this would need to generate code smaller than 8kb for start.
<fremo>
that's cool
<vorago>
(It's veeery simple. Really, nothing to be proud of. But's cooler that I thought it will ever be. ;d)
<fremo>
yes ! :)
<fremo>
I guess :)
slipstream-- has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
descender has quit ["Elegance has the disadvantage that hard work is needed to achieve it and a good education to appreciate it. - E. W. Dijkstra"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
smimou has joined #ocaml
pstickne_ is now known as pstickne
shawn_ has quit ["This computer has gone to sleep"]
Riesz has joined #ocaml
gunark has quit [Read error: 110 (Connection timed out)]
gunark has joined #ocaml
gunark has quit [Read error: 104 (Connection reset by peer)]
gunark has joined #ocaml
pants1 has joined #ocaml
zarvok has joined #ocaml
smimou has quit ["bli"]
johnnowak has quit []
gunark has quit [Read error: 104 (Connection reset by peer)]
gunark has joined #ocaml
Z4rd0Z has joined #ocaml
bluestorm_ has joined #ocaml
<Z4rd0Z>
I'm trying to use ocamlyacc and am running into problems when I compile the code, specifically the "main" driver file
<Z4rd0Z>
how should one decide on the type of the start rule?
gunark has quit [Read error: 104 (Connection reset by peer)]
gunark has joined #ocaml
<Z4rd0Z>
I used <unit>, but I'm getting a type error
<vorago>
I think you should rather use <string>
<vorago>
It can then be read in main.ml
<vorago>
Hm. I can show you mine code. I've just started, but it compiles some code into assembler.
<vorago>
All rules return code in my program. Some rules glue one code to other code, and main rule returns that code.
<vorago>
It's then saved to file.
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
<Z4rd0Z>
when you say the rules return code, do they do it as a string?
<vorago>
Yep.
slipstream has joined #ocaml
<Z4rd0Z>
I'll keep plugging away at it, I'm sure I'll get there
<Z4rd0Z>
the hardest thing for me about ocaml is the static typing
<vorago>
That's one of the best things in Ocaml i think.
<vorago>
;)
<vorago>
If not for ocaml static typing you would not have any error now, but the program could not been working.
mnemonic has joined #ocaml
<mnemonic>
hi
<Z4rd0Z>
vorago: I'm sure that's true, but it does take getting used to
<Z4rd0Z>
at least for me
<Z4rd0Z>
I'm puzzled by how the ocamlyacc tutorial can get away with sending numbers back in the rule actions, but the type of the starting rule is unit
<vorago>
As I remember it lexer sends back numbers in tokens.
<vorago>
Then yacc prints this numbers, or sums of them...
<vorago>
But printf returns unit.
<vorago>
Which is returned by starting rule.
<vorago>
This numbers are not returned by rules and never reaches starting rule.
JeffSmac has joined #ocaml
JeffSmac has quit [Client Quit]
bebui has quit [Remote closed the connection]
mnemonic has quit ["leaving"]
malc_ has joined #ocaml
pstickne has quit [Read error: 110 (Connection timed out)]
pstickne has joined #ocaml
<vorago>
fremo, that ERROR token with string semantic value placed at the end of some rules
<vorago>
send by lexer, and cathed by parser
<vorago>
causes lots of reduce/reduce problems.
<vorago>
I don't know how to solve them.. (there are about 80)
cap__ has joined #ocaml
phoniq has left #ocaml []
david_koontz has joined #ocaml
gim_ has joined #ocaml
Z4rd0Z has quit []
<vorago>
["([^"]|(\\"))*"]
<vorago>
Hm. Question not yet asked.. but i think I've got a solution. Sorry...
david_koontz has quit ["This computer has gone to sleep"]
trisiak has quit [Connection reset by peer]
mikeX has joined #ocaml
david_koontz has joined #ocaml
bluestorm_ has quit ["Konversation terminated!"]
a-priori_ has joined #ocaml
trisiak has joined #ocaml
david_koontz has quit ["This computer has gone to sleep"]
bogdano has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
bogdano has quit [Remote closed the connection]
bogdano has joined #ocaml
david_koontz has joined #ocaml
mikeX has quit [Read error: 110 (Connection timed out)]