Coder Social home page Coder Social logo

slyce-fp's Introduction

Slyce

A flex/bison inspired parser generator for Scala.

What Slyce provides

As an overview, the main 3 things that Slyce provides are:

  • "slyce-generate" jar
  • "slyce-parse" library
  • "sylce-plugin" plugin

"slyce-generate" jar

This can be downloaded from github releases.
It gives you a command line utility for generating parsers using slyce.
(It is definitely going to be less straight-forward than using the plugin).

# generate-help
java -jar slyce-generate-2.1.5.jar --help
# logger-help
java -jar slyce-generate-2.1.5.jar --help --
# basic usage
java -jar slyce-generate-2.1.5.jar generate all -s your-project-name/src/main

"slyce-plugin"

// project/plugins.sbt
addSbtPlugin("io.github.kalin-rudnicki" % "slyce-plugin" % "2.1.5")
// build.sbt
project
  .in(file("your-project-name"))
  .settings(
    // [your other settings]...
    slyceConfigs += SlyceConfig(SlyceInput.SrcDir, SlyceOutput.SrcDir),
  )

"slyce-parse"

// build.sbt
project
  .in(file("your-project-name"))
  .settings(
    // [your other settings]...
    libraryDependencies += "io.github.kalin-rudnicki" %% "slyce-parse" % "2.1.5",
  )

You have a choice between using the command line utility or sbt plugin for generating your parsers, but adding slyce-parse as a dependency is required, as it is used by the generated files.
All slyce-_____ libraries depend on my own FP/utils library klib.

Basic setup with slyce-plugin & slyce-parse

Setup sbt:

// project/plugins.sbt
addSbtPlugin("io.github.kalin-rudnicki" % "slyce-plugin" % "2.1.5")
// build.sbt
lazy val `your-project-name-parsers` =
    project
      .in(file("your-project-name-parsers"))
      .settings(
        // [your other settings]...
        libraryDependencies += "io.github.kalin-rudnicki" %% "slyce-parse" % "2.1.5",
        slyceConfigs += SlyceConfig(SlyceInput.SrcDir, SlyceOutput.SrcDir),
      )
lazy val `your-project-name` =
    project
      .in(file("your-project-name"))
      .dependsOn(
        `your-project-name-parsers`,
      )

Add slyce files:

project-root
|-- your-project-name-parsers
|   |-- src
|   |   |-- main
|   |   |   |-- slyce
|   |   |   |   |-- pkg1
|   |   |   |   |   |-- pkg2
|   |   |   |   |   |   |-- parsers
|   |   |   |   |   |   |   |-- Parser1.slf
|   |   |   |   |   |   |   |-- Parser1.sgf

Then run:

sbt slyce

Which will generate:

project-root
|-- your-project-name-parsers
|   |-- src
|   |   |-- main
|   |   |   |-- scala
|   |   |   |   |-- pkg1
|   |   |   |   |   |-- pkg2
|   |   |   |   |   |   |-- parsers
|   |   |   |   |   |   |   |-- Parser1.scala

If you notice here, we actually generated the files in your-project-name-parsers, instead of your-project-name. This is because the generated files can be relatively large, and something about them at the time being causes sbt to struggle a little bit (on the order of tens of seconds).
Adding it to a separate project will mean sbt will not have to worry about re-compiling them unless you re-generate them.
(as long as you're not putting any other code there).
At least from my testing, if it is in the same project as the code that is using it, it will have to be re-compiled every time.

wiki

Check out the wiki

slyce-fp's People

Contributors

kalin-rudnicki avatar kalinrudnicki avatar

Watchers

 avatar  avatar

slyce-fp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.