Skip to content
AbePralle edited this page May 6, 2019 · 20 revisions

Overview

  • Froley is a "compiler compiler" for creating virtual machine-based tokenizers and parsers.
  • A developer programs their tokenizer and parser in two different domain-specific languages: Froley Tokenizer Language (FTL) and Froley Parser Language (FPL).
  • The Froley compiler turns the Tokenizer and Parser programs into bytecode. It also generates Tokenizer and Parser VMs to run the bytecode along with supporting compiler framework in a specified target language - currently Rogue and Java target languages are supported.
  • Froley can update a previously-generated compiler framework. It will rewrite certain enumerations and add new command node (AST node) class definitions but it will not overwrite any custom modifications that have been made.
  • Consequently the ".froley" source file serves as the master definition for a custom language's syntax, grammar, tokenizer, and parser. Changes and additions made to the language can be easily propagated to various compiler implementations in a variety of host languages.

See:

Usage

froley filename.froley [host-language] [options]

Host Languages

Froley can generate outputs for the following target languages and formats:

  • --target=json
  • --target=rogue

Use --<target-language> to include output for that language. Any successive options will apply only to that language until another --target is specified.

General Options

Option Description
--language=name Specifies the name of the language that the Froley-generated Tokenizer and Parser will parse. For example, to generate Rogue source code that will parse a language called Simple you would write froley --language=Simple --target=rogue. If no --language is specified then the base name of the .froley filename is used as the language name.

Language-Specific Options

--target=json

Option Description
--output=folder Specifies the output folder for generated code.

--target=rogue

Option Description
--framework Creates the following framework files for language "XYZ" if they do not exist: XYZError.rogue, XYZParser.rogue, XYZToken.rogue, XYZTokenizer.rogue. Updates XYZCmd.rogue with starter class definitions of any new command nodes that are not yet defined. Does not delete any code.
--main Creates a main file (if it does not yet exist) to test out the parser and tokenizer. Implies '--framework.
--output=folder Specifies the output folder for generated code.

Clone this wiki locally