Hi,

I am in the middle of converting a large ocaml project into F#. I am also hope to change to light syntax after a while, so I hope to be able to use your program to fix up the source files. The files are created with emacs and uses a lot of tabs.

Some initial comments

  1. I found no source at github, what did I miss?
  2. If the file contains a tab, I get "2001: Unexpected `<Tab>` char in source"
  3. Would be nice if you would allow command line like "-file *.fs" or why not just *.fs. I assume you are not using the Arg-package today?
  4. I do not get source overwriting to work, I send "/r+ -file settings.fs" as arguments
  5. Moves comment to other part of ELSE, see below

Note how the "// default is UTF-8 encoding without a Byte-Order " comment is moved

Before:

1
2
3
4
5
let write_all_text (filename, contents, default_encoding) =
    if utf_8_regexp.Match(contents, 0, min contents.Length 1000 ).Success then // only look in first 1000 chars
        System.IO.File.WriteAllText(filename, contents) // default is UTF-8 encoding without a Byte-Order Mark (BOM),
    else 
        System.IO.File.WriteAllText(filename, contents, default_encoding)

After:

1
2
3
4
5
6
7
et write_all_text ( filename, contents, default_encoding ) = 
    if utf_8_regexp.Match ( contents, 0, min contents.Length 1000 ).Success then 
        // only look in first 1000 chars
        System.IO.File.WriteAllText ( filename, contents )
    else 
        // default is UTF-8 encoding without a Byte-Order Mark (BOM),
        System.IO.File.WriteAllText ( filename, contents, default_encoding )
By on 3/16/2011 3:52 AM ()

Hi,

1. No. You didn't missed anything. The project is under heavy refactoring and reconstructing, so I'm not ready yet to publish sources. Current version had changed from 0.9 near 80% of code. I think, at this stage, the publish of sources is useless.

2. Yes. Translator is not full ML compatible. So you need replace all `Tab`, that is not permitted in F# sources, to 2 or 4 spaces (depends of your IDE preferences).

3. Will be done.

4. Strange. Maybe your source files is locked when you try to use /r+ switch?

5. Unfortunately, I cannot change this behavior at this time, due specifics of generated AST. This another limitation that I forgot to mention. All comment must be before of source codes, which they describe.

On this time the project has moved to
[link:refsharp.codeplex.com]
and has version 1.0.0317

Thanks for investigation

By on 3/16/2011 10:32 PM ()

I was hoping to be able to use the prettyprinter to format non-light-syntax code inte light-syntax. Can it be used for this? I.e. it needs to respect parenthesis and begin/end

By on 3/18/2011 12:09 AM ()

I tried to describe non-light syntax in lexer file FSharp.lex. In most cases it will do tranform non-light to light automaticaly, but I never tested it. You can try to update by yourself grammar rules in FSharp.lex file by eliminating rules of indentation (^#....). Sorry, I have not described the *.lex files yet.

By on 3/25/2011 9:35 AM ()

By now "C# to F# translator" is ready. Translator does not make any intellectual job, like convert for loops with `break` statements into recursive functions, but it can convert almost all code of C# to F# (linq is not supported). You can try convertor as toy, or as tool for helping conversion from C# code.

[link:refsharp.codeplex.com]

By on 4/8/2011 11:12 PM ()

The overwriting error only occurs for one file. Maybe it was perfectly formatted before.

By on 3/18/2011 12:05 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper