On Mar 8, 2009, at 5:04 PM, Matthieu Wipliez wrote:
In the parser, did you replace
module Gram = Camlp4.Struct.Grammar.Static.Make(Lexer)
by
module Gram = Static1.Make(Lexer)
I forgot to fix match_keyword. Works otherwise, thanks!
Now, why is match_keyword supplied with the original keywo
> > Well I just duplicated Static to Static1 (and added Camlp4.Struct.Grammar
> where necessary) and replaced:
> > module Structure = Camlp4.Struct.Grammar.Structure.Make Lexer;
> > by:
>
> Something like this you mean? I must be doing something wrong as I never see
> my
> printout from 'usin
On Mar 8, 2009, at 3:55 PM, Matthieu Wipliez wrote:
Well I just duplicated Static to Static1 (and added
Camlp4.Struct.Grammar where necessary) and replaced:
module Structure = Camlp4.Struct.Grammar.Structure.Make Lexer;
by:
Something like this you mean? I must be doing something wrong as I
> I don't think this will work elegantly.
>
> Static first makes a Structure (is make the right term?) and then makes a
> bunch
> of other modules using it. A custom Structure will be needed to downcase the
> keywords before inserting them into the hash table, so Static will need to be
> dupli
> > I believe there is a (partially acceptable) solution, if you are willing to
> accept having all your keywords in lower-case in the grammar (not in the
> lexer),
> ie you match against "buyorsell", "sellshort" etc.
>
> Nope, I want camel case! :D
lol ok :-)
> I think a functor or somethin
On Mar 8, 2009, at 3:07 PM, Matthieu Wipliez wrote:
I believe there is a (partially acceptable) solution, if you are
willing to accept having all your keywords in lower-case in the
grammar (not in the lexer), ie you match against "buyorsell",
"sellshort" etc.
Nope, I want camel case! :D
> And this is the part that I object to. I have quite a number of keywords and
> I
> don't want to have a bunch of if statements or have a hash table mapping
> lowercase to camel case. This would mean having to track the parser (camel
> case)
> version in two places: the lexer and the parser.
On Mar 8, 2009, at 2:09 PM, Matthieu Wipliez wrote:
using a single rule, say
buy : [ [ "buyOrSell"; ... ] ]
Yes, I want camel-case above.
and at lexing time do
if String.lowercase s = "buyorsell" then
IDENT "buy_or_sell"
else
IDENT s
And this is the part that I object to. I have
> > So to sum up: when you declare a rule with a token "MyToken", the grammar
> > is
> configured to recognize a "MyToken" keyword.
>
> The issue here is that it must be lower case in the camlp4 rules, i.e.
> "mytoken".
Why "it must"? You need it to be lower-case? Or parsing does not work if
> > In this case, here is a possible solution, you have your hash table
> > associate
> a lowercase version of the token with what you'd like to use in the grammar:
> > "buytocover" => "BuyToCover"
> > "sellshort" => "SellShort"
> > ...
>
>
> I'm doing this already but I don't think it will do
On Mar 8, 2009, at 11:45 AM, Matthieu Wipliez wrote:
In this case, here is a possible solution, you have your hash table
associate a lowercase version of the token with what you'd like to
use in the grammar:
"buytocover" => "BuyToCover"
"sellshort" => "SellShort"
...
I'm doing this alrea
ld this satisfy your requirements?
Cheers,
Matthieu
- Message d'origine
> De : Joel Reymont
> À : Matthieu Wipliez
> Cc : O'Caml Mailing List
> Envoyé le : Dimanche, 8 Mars 2009, 9h25mn 23s
> Objet : Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax
&g
Hi,
On Sun, Mar 08, 2009 at 11:07:02AM +, Joel Reymont wrote:
> Should I just invoke Gram.using ... ? I feel that the solution is
> staring me in the face here but I still can't recognize it. Help!!!
Well, I am afraid it is probably Camlp4 (not 5). Nicolas Pouillard
probably could help, I
On Mar 8, 2009, at 10:35 AM, Joel Reymont wrote:
The filter module nested in the token module seems like a good
candidate. What functions of the lexer or filter are accessed when a
string keyword (e.g. "delay") is found in the camlp4 grammar?
The filter portion of the token module looks l
On Mar 8, 2009, at 10:27 AM, Daniel de Rauglaudre wrote:
Only changing the "tok_match" record field (2nd point) would not work
for keywords (defined by "just a string" in Camlp* grammars), because
the lexer *must* recognize all combinations of the identifier as
keywords, implying a change, anyw
Hi,
On Sun, Mar 08, 2009 at 09:51:26AM +, Joel Reymont wrote:
> I would prefer to use the #2 approach but I'm using a custom lexer
> built by ocamllex.
Mmm... I am not eventually sure that what I said was correct... I should
test it myself, what I generally do before asserting things... :-
I would prefer to use the #2 approach but I'm using a custom lexer
built by ocamllex.
Where would I plug in String.lowercase con = ... in Matthieu's lexer,
for example?
Thanks, Joel
On Mar 8, 2009, at 9:37 AM, Daniel de Rauglaudre wrote:
2/ Use the field "tok_match" of the interfa
Hi
On Sun, Mar 08, 2009 at 08:25:23AM +, Joel Reymont wrote:
> How can I make camlp4 parsing case-insensitive?
I think it should work with doing the two following things (both):
1/ Change your lexer to generate case-insensitive tokens.
2/ Use the field "tok_match" of the interface with the
On Mar 8, 2009, at 1:08 AM, Matthieu Wipliez wrote:
actionDelay: [ [ "delay"; expression ->
Asthelper.failwith (convert_loc _loc)
"RVC-CAL does not permit the use of delay." ] ];
Which of the following tokens does "delay" get checked against?
I'm assuming that camlp4 has
How can I make camlp4 parsing case-insensitive?
The only approach I can think of so far is to build a really larger
set of tokens and use them instead of strings in the parser.
Any flag I can flip or way to do this without a large set of tokens?
Thanks, Joel
On Mar 8, 2009, at 1:08
> Matthieu,
>
> Is the camlp4 grammar parser case-insensitive?
>
> Will both Delay and delay be accepted in the actionDelay rule?
>
> actionDelay: [ [ "delay"; expression ->
> Asthelper.failwith (convert_loc _loc)
> "RVC-CAL does not permit the use of delay." ] ];
No, o
Matthieu,
Is the camlp4 grammar parser case-insensitive?
Will both Delay and delay be accepted in the actionDelay rule?
actionDelay: [ [ "delay"; expression ->
Asthelper.failwith (convert_loc _loc)
"RVC-CAL does not permit the use of delay." ] ];
On Mar 7, 2009, at 11:21 PM, Matthieu Wipliez wrote:
why are you using stream parsers instead of Camlp4 grammars ?
Because I don't know any better? I'm just starting out, really.
I have a parser that I wrote using ocamlyacc and menhir. I finally
when with dypgen and didn't touch the code f
Hi Joel,
why are you using stream parsers instead of Camlp4 grammars ?
This:
> let rec parse_primary = parser
>
> | [< 'INT n >] -> Int n
> | [< 'FLOAT n >] -> Float n
> | [< 'STRING n >] -> Str n
> | [< 'TRUE >] -> Bool true
> | [< 'FALSE >] -> Bool false
>
> | [< >] -> raise (Stre
24 matches
Mail list logo