fsharp / fslang-suggestions

The place to make suggestions, discuss and vote on F# language and core library features
346 stars 21 forks source link

Add plugable preprocesser support to compiler #448

Closed baronfel closed 8 years ago

baronfel commented 8 years ago

Add plugable preprocesser support to compiler [8210280]

Submitted by Xavier Zwirtz on 6/2/2015 12:00:00 AM
4 votes on UserVoice prior to migration

Add support for handing in a preprocessor dll to the compiler. A preprocessor dll would be able to receive the AST at different stages of the compile process and modify it. It would be specified with --pre assembly-name.dll You would have a type Main that exposes different functions depending on the stage that you want to modify. module Main = // receives raw unprocessed text and returns a string to advance. // would allow for extension of syntax and reader macros let Reader code = modify code // receives an untype checked but syntactically valid AST. // returns an AST let ProcessAST ast = modify ast // recieves an a type checked AST. // if your preprocesser does not need to process an untyped tree this simplifies development let ProcessTypedAST ast = modifyTyped ast This would allow for a variety of compile time enhancements to be added to F# ala Lisp and D, with out locking the language down to a single implementation. For instance, in Racket a file may be begun with #lang {nameOfLang} that directs the compiler to the language to use. Using the above suggestion the same functionality could be added by the community, allowing for different languages to have transpilers written for them and then transformed during the compile process. It would also allow for more "simple" plugins to be made, like syntactic macros.

Response

\ by fslang-admin on 7/17/2015 12:00:00 AM **

Many thanks for this suggestion. It is being marked as declined – for discussion see the comments above. Don Syme, F# Language and Core Library Evolution.

Original UserVoice Submission Archived Uservoice Comments

codingedgar commented 4 years ago

Is this still out of question?

codingedgar commented 4 years ago

The link of the response is broken, but this one works:

https://github.com/fsharp/fslang-suggestions/blob/d48c35ce216e2bff148937ec028ad61e5c273fdf/archive/suggestion-8210280-add-plugable-preprocesser-support-to-compiler.md

cartermp commented 4 years ago

Yes, this is still out of the question.