-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
4,038 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Eclipse # | ||
.classpath | ||
.cache | ||
.project | ||
.settings/ | ||
bin/ | ||
*.fxbuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Contributing | ||
|
||
This project became open source and is under very active development. We are working out bits and pieces that needs refactoring as well as implementing new technologies and functionality. Hopefully this document will help you understand the process for contributing and making proposals. | ||
|
||
## Code of Conduct | ||
|
||
Our team has adapted a Code of Conduct from the Contributor Covenant, version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>. Please read the full text so that you can understand what actions will and will not be tolerated. | ||
|
||
## Branch Organization | ||
|
||
All development on LL(1) Compiler happens directly on [GitHub][github] which means that we try to keep code in good shape. We recommend that you use the [latest stable version][release] of the project. There are two major branches. | ||
|
||
* The [**master** branch][masterB] is the latest stable version that has been tested | ||
* The [**develop** branch][devB] is the current under development build. | ||
|
||
## Bugs | ||
|
||
The best way to get a bug fixed is to fill an issue. You must provide enough details and explain a test case. We keep track of all issues and try to make it clear when we have a fix in progress. Before filling an issue, try to make sure your issue doesn't already exist. | ||
|
||
## Proposals | ||
|
||
If you wish to make a proposal, we recommend filing an issue. This lets us review your proposal and get back to you with thoughts and feedback. Whether it is a bug-fix or an addition to the functionality of the project, make sure to provide enough details on the matter. | ||
|
||
## Pull Requests | ||
|
||
If you want to send a pull request, please create a new branch on your forked repository and then do it against the [**develop** branch][devB]. Your pull request will undergo review and if there are non-breaking changes, it will be merged for further testing. Otherwise we may request changes to it or close it with corresponding explanation. We will do our best to provide updates and feedback throughout the process. | ||
|
||
## Versioning | ||
|
||
We follow [semantic versioning][semver]. This means that incrementation of version follows this rule: MAJOR.MINOR.PATCH. | ||
|
||
* *MAJOR* version when we make ground-breaking changes in codebase or when there are incompatibilities between two builds | ||
* *MINOR* version when additional functionality is added | ||
* *PATCH* version when bug-fixes take place | ||
|
||
We may use additional labels for pre-release and beta versions. | ||
|
||
[semver]: https://semver.org/ | ||
[masterB]: https://github.com/sotostzam/LL1_Compiler/tree/master | ||
[devB]: https://github.com/sotostzam/LL1_Compiler/tree/develop | ||
[github]: https://github.com/sotostzam/LL1_Compiler | ||
[release]: https://github.com/sotostzam/LL1_Compiler/releases/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# [LL(1) Compiler](http://tzamaras.com/LL1_Compiler.php) · [![License](https://img.shields.io/github/license/sotostzam/LL1_Compiler.svg)](https://img.shields.io/github/license/sotostzam/LL1_Compiler.svg) [![Release](https://img.shields.io/github/release/sotostzam/LL1_Compiler.svg)](https://img.shields.io/github/release/sotostzam/LL1_Compiler.svg) [![Downloads](https://img.shields.io/github/downloads/sotostzam/LL1_Compiler/total.svg)](https://img.shields.io/github/downloads/sotostzam/LL1_Compiler/total.svg) | ||
|
||
This is a LL(1) Parser which includes an integrated graphical user interface. Being still a work in progress, in the future it would be a full LL(1) Compiler. This application is intended for computer science students and autodidacts studying compilers or parsers. | ||
|
||
## Demo | ||
|
||
![Demo](http://tzamaras.com/images/new_gui.png) | ||
|
||
## Table of contents | ||
|
||
* [Features](#features) | ||
* [Getting Started](#getting-started) | ||
* [Prerequisites](#prerequisites) | ||
* [Installing](#installing) | ||
* [Deployment](#deployment) | ||
* [Usage](#usage) | ||
* [Author](#author) | ||
* [Contributing](#contributing) | ||
* [Acknowledgments](#acknowledgments) | ||
* [License](#license) | ||
|
||
## Features | ||
|
||
* Create custom LL(1) grammar rules | ||
* Import and export of grammar rules | ||
* Generate of first sets, follow sets and the parsing table | ||
* Each step is accompanied by visual feedback and explanatory text | ||
* Seamlessly checks if a string is recognized with error reporting | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
* You will need any OS able to run Java like Windows or Linux | ||
* You must have **[Java JDK 8][java]** installed, which already includes JavaFX | ||
* You will also need an editor or an IDE like **[Eclipse IDE][eclipse]** | ||
* You can use **[e(fx)clipse 3.0][efxclipse]** or newer for eclipse | ||
|
||
### Installing | ||
|
||
1. Fork this repository on your Github account | ||
2. Clone *your forked repository* to your hard drive with `git clone https://github.com/YOURUSERNAME/LL1_Compiler.git` | ||
3. Change location to that folder | ||
4. Open your favorite IDE/Editor create a new javafx project | ||
5. Manually import your forked repository's files | ||
6. Build and run the application | ||
|
||
### Deployment | ||
|
||
In order to deploy a runnable .jar file follow these steps: | ||
|
||
* Go to file -> Export | ||
* From the Java menu select Runnable JAR file | ||
* Select launch configuration | ||
* Select Export destination | ||
* Double click to run the generated file | ||
|
||
### Usage | ||
|
||
1) Launch the application | ||
2) Click on the *Import Rules* tab | ||
* From here you can add your own rules | ||
* Or select some of the pre-loaded ones | ||
* Click the *Save rules* button | ||
3) Run the *first, follow and parsing table* algorithms by pressing the corresponding tabs. You are also able to analytically see how each step is generated | ||
4) Now you can analyze an input string whether it matches your grammar rules | ||
|
||
## Author | ||
|
||
**Sotirios Tzamaras** **·** Development Lead | ||
|
||
* [Website](http://tzamaras.com) | ||
* [Github](https://github.com/sotostzam) | ||
* [LinkedIn](https://www.linkedin.com/in/sotiris-tzamaras/) | ||
|
||
## Contributing | ||
|
||
As an open source software, we would be grateful if you wish to contribute bugfixes and improvements. Read our [CONTRIBUTING.md](CONTRIBUTING.md) to learn about how to report issues and how to propose bugfixes and improvements. | ||
|
||
A special thanks to all of our contributors and testers so far: | ||
|
||
* [Angelis Vasilios](http://github.com/ang) (Follow algorithm and Unit testing) | ||
|
||
## Acknowledgments | ||
|
||
The idea of this application was founded within the framework of the course named "Principles of Languages and Translators", taught by assistant professor Stavros Adam at the university of Ioannina (Former Technological Educational Institute of Epirus). | ||
|
||
## License | ||
|
||
This project is licensed under the GNU General Public Version 3 License - see the [LICENSE.md](LICENSE.md) file for details | ||
|
||
[java]: https://www.java.com/en/download/ | ||
[efxclipse]: https://www.eclipse.org/efxclipse/install.html | ||
[eclipse]: https://www.eclipse.org/downloads/packages/release/2019-03/r/eclipse-ide-enterprise-java-developers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package application; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.LinkedHashMap; | ||
import java.util.Scanner; | ||
|
||
public class Compiler{ | ||
|
||
static LinkedHashMap<Character, String> rules = new LinkedHashMap<Character, String>(); | ||
static final char[] grammarNonTerminal = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); | ||
static final char[] grammarTerminal = "abcdefghijklmnopqrstuvwxyz->%:!|,#$()*+/ε.".toCharArray(); | ||
static boolean deleteEpsilon = false; | ||
public static String language = ""; | ||
static String version = ""; | ||
static String revDate = ""; | ||
static boolean bootFound = true; | ||
|
||
private static void bootConfig () { | ||
InputStream streamIn = Compiler.class.getResourceAsStream("/data/boot.config"); | ||
Scanner scanner = new Scanner(streamIn); | ||
scanner.useDelimiter("\\r?\\n"); | ||
while (scanner.hasNextLine()) { | ||
String inputLine = scanner.next(); | ||
if(inputLine.contains("#LANGUAGE")) { | ||
String bootLangFile = "./lang.info"; | ||
try { | ||
FileInputStream file = new FileInputStream(bootLangFile); | ||
InputStreamReader inputReader = new InputStreamReader(file, StandardCharsets.UTF_8); | ||
Scanner langScanner = new Scanner(inputReader); | ||
scanner.useDelimiter("\\r?\\n"); | ||
inputLine = langScanner.next(); | ||
langScanner.close(); | ||
} catch (FileNotFoundException e) { | ||
bootFound = false; | ||
} | ||
inputLine = inputLine.substring(inputLine.indexOf("=") + 1); | ||
language = inputLine; | ||
} | ||
else if (inputLine.contains("#VERSION")) { | ||
inputLine = inputLine.substring(inputLine.indexOf("=") + 1); | ||
version = inputLine; | ||
} | ||
else if (inputLine.contains("#REVDATE")) { | ||
inputLine = inputLine.substring(inputLine.indexOf("=") + 1); | ||
revDate = inputLine; | ||
} | ||
} | ||
scanner.close(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
bootConfig(); | ||
Graphics.startGraphics(args); | ||
//System.out.println(javafx.scene.text.Font.getFamilies()); | ||
//System.out.println(com.sun.javafx.runtime.VersionInfo.getRuntimeVersion()); | ||
} | ||
} |
Oops, something went wrong.