On Sat, 2007-08-25 at 22:48 -0700, Erick Tryzelaar wrote:
> On 8/25/07, skaller <[EMAIL PROTECTED]> wrote:
> > On Sat, 2007-08-25 at 14:44 -0700, Erick Tryzelaar wrote:
> > > I couldn't figure out if there's any way to dump out the scheme code
> > > before it's processed by sex2flx. Did I miss an option somewhere, or
> > > is this not currently exposed on the command line?
> >
> > Run flxp instead of flxg. It sets the 'pdebug' flag:
>
> This isn't exactly what I'm looking for. What I'd like is some
> mechanism to print out an arbitrary piece of felix code that's
> converted to scheme ast. I'm looking for something like the commented
> out code in ocs2flx in flx_parser.ipk that prints out the ast before
> it gets converted to felix. This can be used to see how a common
> expression like:
>
> map (fun (x:int, y:int) => x + y) (1,2,3);
>
> Looks like in scheme.
Glue:
print_endline (Ocs_print.string_of_ocs r)
where you need it, eg at the top of:
let ocs2flx sr r =
let sex = Ocs2sex.ocs2sex r in
(*
print_endline "OCS scheme term converted to s-expression:";
Sex_print.sex_print sex;
*)
let fresh = ref 1 in
let env = [] in
let flx = Flx_sex2flx.xstatement_t sr fresh env sex in
(*
print_endline "s-expression converted to Felix statement!";
print_endline (string_of_statement 0 flx);
*)
flx
which is in flx_parser. It's called by:
statement_star:
| statement_star statement
@{
let seq,sr,s = $2 in
(match s with Snull -> $1 | _ ->
let sseq,stmts = $1 in
let s' = ocs2flx sr s in
(max seq sseq, (s' :: stmts))),
[Keep_grammar true; Local_data (dyp.last_local_data)]
}
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language