{"id":13593687,"url":"https://github.com/jflex-de/jflex","last_synced_at":"2025-05-13T21:04:55.971Z","repository":{"id":27343961,"uuid":"30818918","full_name":"jflex-de/jflex","owner":"jflex-de","description":"The fast scanner generator for Java™ with full Unicode support","archived":false,"fork":false,"pushed_at":"2025-01-01T22:25:36.000Z","size":23214,"stargazers_count":604,"open_issues_count":35,"forks_count":117,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-28T13:58:57.324Z","etag":null,"topics":["bazel-rules","cup","dfa","dfa-minimization","flex","grammar","java","lexer","lexer-generator","lexical-analyzer","maven-plugin","nfa","parsing","regexp","scanner","scanner-generator","tokenizer","yacc"],"latest_commit_sha":null,"homepage":"http://jflex.de","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jflex-de.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-02-15T05:33:03.000Z","updated_at":"2025-04-21T18:53:59.000Z","dependencies_parsed_at":"2025-04-12T07:10:18.560Z","dependency_job_id":null,"html_url":"https://github.com/jflex-de/jflex","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jflex-de%2Fjflex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jflex-de%2Fjflex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jflex-de%2Fjflex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jflex-de%2Fjflex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jflex-de","download_url":"https://codeload.github.com/jflex-de/jflex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254028508,"owners_count":22002273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel-rules","cup","dfa","dfa-minimization","flex","grammar","java","lexer","lexer-generator","lexical-analyzer","maven-plugin","nfa","parsing","regexp","scanner","scanner-generator","tokenizer","yacc"],"created_at":"2024-08-01T16:01:23.171Z","updated_at":"2025-05-13T21:04:50.960Z","avatar_url":"https://github.com/jflex-de.png","language":"Java","readme":"\u003c!--\n  Copyright 2023, Gerwin Klein, Régis Décamps, Steve Rowe\n  SPDX-License-Identifier: CC-BY-SA-4.0\n--\u003e\n\n[![Build](https://github.com/jflex-de/jflex/actions/workflows/build.yml/badge.svg)](https://github.com/jflex-de/jflex/actions/workflows/build.yml)\n\n# JFlex\n\n[JFlex][jflex] is a lexical analyzer generator (also known as scanner generator) for Java.\n\nJFlex takes as input a specification with a set of regular expressions and corresponding actions.\nIt generates Java source of a lexer that reads input, matches the input against the regular\nexpressions in the spec file, and runs the corresponding action if a regular expression\nmatched. Lexers usually are the first front-end step in compilers, matching keywords, comments,\noperators, etc, and generating an input token stream for parsers.\n\nJFlex lexers are based on deterministic finite automata (DFAs).\nThey are fast, without expensive backtracking.\n\n\n## Usage\n\nFor documentation and more information see the [JFlex documentation][jflex-doc]\nand the [wiki][wiki].\n\n### Usage with Maven\n\n[![Maven central](https://img.shields.io/maven-central/v/de.jflex/jflex.svg)](https://search.maven.org/artifact/de.jflex/jflex/)\n\nYou need [Maven][maven] 3.5.2 or later, and JDK 8 or later.\n\n1. Place grammar files in `src/main/flex/` directory.\n\n2. Extend the project [POM build section][pom-build] with the `maven-jflex-plugin`\n\n    ```xml\n      \u003cbuild\u003e\n        \u003cplugins\u003e\n          \u003cplugin\u003e\n            \u003cgroupId\u003ede.jflex\u003c/groupId\u003e\n            \u003cartifactId\u003ejflex-maven-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e1.9.0\u003c/version\u003e\n            \u003cexecutions\u003e\n              \u003cexecution\u003e\n                \u003cgoals\u003e\n                  \u003cgoal\u003egenerate\u003c/goal\u003e\n                \u003c/goals\u003e\n              \u003c/execution\u003e\n            \u003c/executions\u003e\n          \u003c/plugin\u003e\n        \u003c/plugins\u003e\n      \u003c/build\u003e\n    ```\n\n3. Voilà: Java code is produced in `target/generated-sources/` during the `generate-sources` phase\n(which happens before the `compile` phase) and included in the compilation scope.\n\n### Usage with ant\n\nYou need ant, the binary JFlex jar and JDK 8 or later.\n\n1. Define ant task\n\n    ```xml\n    \u003ctaskdef classname=\"jflex.anttask.JFlexTask\" name=\"jflex\"\n            classpath=\"path-to-jflex.jar\"/\u003e\n    ```\n\n2. Use it\n\n    ```xml\n    \u003cjflex file=\"src/grammar/parser.flex\" destdir=\"build/generated/\"/\u003e\n    \u003cjavac srcdir=\"build/generated/\" destdir=\"build/classes/\"/\u003e\n    ```\n\n### Usage with Bazel\n\nWe provide a [jflex rule](https://jflex-de.github.io/bazel_rules/)\n\n```bazel\nload(\"@jflex_rules//jflex:jflex.bzl\", \"jflex\")\n\njflex(\n    name = \"\",           # Choose a rule name\n    srcs = [],           # Add input lex specifications\n    outputs = [],        # List expected generated files\n)\n```\n\nSee the sample [simple BUILD](https://github.com/jflex-de/jflex/blob/master/jflex/examples/simple/BUILD.bazel)\nfile.\n\n### Usage in CLI\n\nYou need the binary jflex jar and JDK 8 or later.\n\nYou can also use JFlex directly from the command line:\n\n```sh\njflex/bin/jflex src/grammar/parser.flex\n```\n\nOr:\n\n```sh\njava -jar jflex-full-1.9.0.jar -d output src/grammar/parser.flex\n```\n\n### Other build tools\n\nSee [Build tool plugins](https://github.com/jflex-de/jflex/wiki/Build-tool-integration).\n\n\n## Examples\n\nHave a look at the sample project: [simple][example-simple] and other [examples].\n\n## Contributing\n\n[![Javadoc](https://javadoc.io/badge2/de.jflex/jflex/javadoc.svg)](https://javadoc.io/doc/de.jflex/jflex)\n\nJFlex is free software, contributions are welcome.\nSee the [Contributing][contrib] page for instructions.\n\n### Source layout\n\nThe top level directory of the JFLex git repository contains:\n\n- **cup** A copy of the CUP runtime\n- **cup-maven-plugin** A simple Maven plugin to generate a parser with CUP.\n- **docs** the Markdown sources for the user manual\n- **java** Java sources [WIP, Bazel]\n- **javatests** Java sources of test [WIP, Bazel]\n- **jflex** JFlex, the scanner/lexer generator for Java\n- **jflex-maven-plugin** the JFlex maven plugin, that helps to integrate JFlex in your project\n- **jflex-unicode-plugin** the JFlex unicode maven plugin, used for compiling JFlex\n- **testsuite** the regression test suite for JFlex,\n- **third_party** third-party libraries used by examples of the [Bazel build system][bazel]\n\n\n### Build from source\n\n#### Build with Bazel\n\nJFlex can be built with Bazel.\n[Migration to Bazel][migration-bazel] is still work in progress, concerning the test suite, for instance.\n\nYou need [Bazel][bazel].\n\n```sh\nbazel build //jflex:jflex_bin\n```\n\nThis builds `bazel-bin/jflex/jflex_bin`, that you can use\n\n```sh\nbazel-bin/jflex/jflex_bin --info\n```\n\nOr:\n\n```sh\nbazel run //jflex:jflex_bin -- --info\n```\n\nBuild uberjar (aka fatjar aka deploy jar)\n\n```sh\nbazel build jflex/jflex_bin_deploy.jar\n```\n\n#### Build with Maven\n\nYou need JDK 8 or later.\n\n```sh\n./mvnw install\n```\n\nThis generates `jflex/target/jflex-full-1.9.1-SNAPSHOT.jar` that you can use, e.g.\n\n```sh\njava -jar jflex-full-1.9.1-SNAPSHOT.jar --info\n```\n\n\n[jflex]: http://jflex.de/\n[jflex-doc]: http://jflex.de/manual.html\n[wiki]: https://github.com/jflex-de/jflex/wiki\n[pom-build]: https://maven.apache.org/pom.html#Build_Settings\n[example-simple]: https://github.com/jflex-de/jflex/tree/master/jflex/examples/simple\n[examples]: https://github.com/jflex-de/jflex/tree/master/jflex/examples/\n[contrib]: https://github.com/jflex-de/jflex/wiki/Contributing\n[bazel]: https://bazel.build/\n[maven]: https://maven.apache.org/\n[migration-bazel]: https://github.com/jflex-de/jflex/wiki/Migration-to-Bazel\n","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjflex-de%2Fjflex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjflex-de%2Fjflex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjflex-de%2Fjflex/lists"}