Giter VIP home page Giter VIP logo

vparser_cfg's Introduction

Java CI with Maven Language grade: Java Total alerts

Table of Contents

Installation

VParser_CFG is hosted on the JitPack package repository which supports Gradle, Maven, and sbt.

Gradle Gradle

Add JitPack to your build.gradle at the end of repositories.

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add VParser_CFG as a dependency.

dependencies {
	implementation 'com.github.Valkryst:VParser_CFG:2022.01.08-2'
}

Maven Maven

Add JitPack as a repository.

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Add VParser_CFG as a dependency.

<dependency>
    <groupId>com.github.Valkryst</groupId>
    <artifactId>VParser_CFG</artifactId>
    <version>2022.01.08-2</version>
</dependency>

Scala SBT Scala SBT

Add JitPack as a resolver.

resolvers += "jitpack" at "https://jitpack.io"

Add VParser_CFG as a dependency.

libraryDependencies += "com.github.Valkryst" % "VParser_CFG" % "2022.01.08-2"

Usage

  1. Create a set of rules.
  2. Create a ContextFreeGrammar using the rules.
  3. Run the ContextFreeGrammar.

Notes

A ContextFreeGrammar requires at least one rule, and each rule must begin with a terminal and be followed by zero or more non-terminals. These are examples of valid rules:

A aA aB aC a
B bA bC b
c
A thisA isB
B aA aC
C validA ruleB c

Example

public class Example {
	public static void main(final String[] args) {
		/*
		 * The following set of rules was created using these names:
		 *
		 * 		Balin, Bifur, Bofur, Bombur, Borin, Dain, Dis, Dori, Dwalin,
		 * 		Farin, Fili, Floi, Frar, Frerin, Fror, Fundin, Gaiml, Gimli,
		 * 		Gloin, Groin, Gror, Ibun, Khim, Kili, Loni, Mim, Nain, Nali,
		 * 		Nar, Narvi, Nori, Oin, Ori, Telchar, Thorin, Thrain, Thror
		 */
		final var rules = new String[]{
				"A B C D E F G H I K L M N O P Q R S T U V W X Y Z",
				"A a aL aI aR",
				"B b bA bI bO",
				"C c",
				"D d dA dI dO dW dU",
				"E e eR eL",
				"F f fA fI fL fR fU fO",
				"G g gA gI gL gR",
				"H h hI hA",
				"I i",
				"K k kH kI",
				"L l lO",
				"M m mI",
				"N n nA nO",
				"O o oI oR",
				"P p",
				"Q q",
				"R r rI rO rV",
				"S s",
				"T t tE tH",
				"U u uR uN",
				"V v",
				"W w wA",
				"X x",
				"Y y",
				"Z z"
		};

		final var cfg = new ContextFreeGrammar(rules);

		for (int i = 0 ; i < 1000 ; i++) {
			String res = cfg.run();

			// Exclude low-quality results.
			if (res.length() > 3) {
				System.out.println(res);
			}
		}
	}
}
guroro
hfkh
eroi
forv
oror
bunoroi
erorv
gnoi
thlo
glorv
oroi
lori
loroi
hter
wurv
funo
elori
thhi
furi
norv
ungrv
unoi
teri
dher
loro
froi
...

vparser_cfg's People

Contributors

dependabot[bot] avatar valkryst avatar

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.