Skip to content
AbePralle edited this page Apr 21, 2019 · 20 revisions

Overview

Froley is a "compiler compiler" for creating virtual machine-based tokenizers and parsers.

A single .froley definition file is compiled to a .json file containing compressed bytecode as well as various definitions. Froley can save the JSON file for further processing with the --json option and/or it can create and/or update a complete parser and tokenizer framework in a specified language. Currently only Rogue is supported.

The Demos/ folder contains several full Froley examples that can be adapted to your own projects. In each case only the .froley file is necessary and all other parser infrastructure can be generated from it.

Ensure that Rogue is installed and then execute the following commands to try the different examples:

  • rogo simple
  • rogo csq
  • rogo json
  • rogo asm

See:

Usage

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

Host Languages

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

  • --json
  • --rogue

Use --<host-language> to include output for that language. Any successive options will apply to that language only. Multiple host languages can be 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 --rogue. If no --language is specified then the base name of the .froley filename is used as the language name.

Language-Specific Options

--json

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

--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