Fable icon indicating copy to clipboard operation
Fable copied to clipboard

Is there a detailed description or manual for this repository and its code architecture?

Open gmono opened this issue 1 year ago • 1 comments

I am very interested in this compiler and am currently using this platform in a production project (with the goal of cross-language compilation). Is there a manual or detailed documentation for this code repository that would allow me to quickly get involved in the development of this compiler?

gmono avatar Dec 29 '24 10:12 gmono

Hello @gmono,

We don't have a manual for this repository however, I made a F# Amplifying session about it.

I encourage you to watch it as I am giving a tour of Fable and show how to contribute to it.

A quick summary of the repo is:

Below the src folder you will find:

  • Fable.Build: this is a build orchestrator you can invoke it using ./build.sh and see all the different option available. You can see it like a MakeFIle.
  • fable-library-X : contains the native representation of F# / Fable function used by the X target, for example it contains the API to work with Date, Reflection, List, etc.
  • Fable.Core: offers Fable specific API for import, emit of code, standard target API like JS.console.log for JS
  • Fable.Cli: entry point of the Fable CLI
  • Fable.Compiler: contains the logic to crack a F#/Fable project (retrieves dependencies, cache info, etc.)
  • Fable.Transforms: contains the actual Fable logic which does:
    • F# AST to Fable AST
    • Transform Fable AST to target AST (JavaScript, Python, etc.) it does both a direct replacement for example to transform a variable in F# to a variable in Python, JavaScript when possible or use what we call replacement which map API to call API from fable-library-X or native API
  • Fable.AST: describe the AST that Fable use to transform the code, it is used by both Fable.Transform and also by Fable plugins so people can modify Fable output if needed. Feliz does it to offers an alternative React syntax.
  • quicktest(-X): contains a small F# project used to quickly test out something. This is useful when working on a feature because we can isolate a tests instead of having to debug a 1000-2000+ tests project. This make is possible also to minimise the AST we are working with when trying to debug something

Below the tests folder, you will find the global test suite we have for Fable and the different target.

In general, if you want to work on the project you either use the build.sh or using VSCode we have a lot of debugger configuration already setup so you can debug Fable while it is running locally.

If you have anything you want to work on specifically, please feel free to open an issue or PR and we will do our best to guide you.

MangelMaxime avatar Dec 29 '24 15:12 MangelMaxime