Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
✨ v1.4.0! (#14)
Browse files Browse the repository at this point in the history
* Preparing for #12 and #1

* Optimizations!

* Contributing? Read this.

* Commit-point!

* Optimization!

* Optimization + New Flag!

* Commit-point!

* Fixed it finally

* Segragation + printProxy enlarged

* An Even Bigger Print Capacity!

* Commit-point!

* Commit-point!

* FINALLY. Just, FINALLY.

* Version bump!

* Bug found, delaying release :(

* Human error, not the language's fault.

* Redocs + Bug Fix

* Bug Fixes

* Final Version Bump!
  • Loading branch information
JumperBot authored Nov 22, 2022
1 parent 683cbba commit 29083d8
Show file tree
Hide file tree
Showing 30 changed files with 659 additions and 700 deletions.
32 changes: 22 additions & 10 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ so **be careful** on what you're doing!

Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable.

Use the table of contents icon <img src="https://github.com/github/docs/blob/7ada1b26cf14e242d78ddf021ab743158b6a87f2/assets/images/table-of-contents.png" width="20em" height="20em" /> on the top left corner of this document to get to a specific section of this guide quickly.
---

## New contributor guide
## Contributing code

To get an overview of the project, check out our [README](README.md).
### Before contributing

Here are some resources to help you get started with open source contributions:
You must know this before contributing:

- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
- Your contribution might be rejected for considerable reason(s).
- Your submitted code might be or will be ___ with or without you knowing.
- removed within the bounds of the project
- modified as needed or as necessary
- moved within the bounds of the project
- copied within the bounds of the project
- You will be known as a contributor of this repository.
- You might be called out to fix a bug created by your code if necessary.

To give us a suggestion on what utility to do next, you can open up an [issue](https://github.com/JumperBot/Unsafe-4-Bit/issues/new/choose).
---

### How to start writing "the" code

Expand All @@ -38,6 +42,8 @@ The first and most important step is getting to know yourself and your setup:
Next step would be ***\*drum-roll\**** forking the repository!
- You can now write the actual code.

---

### What to do when writing the code

- Make the code **concise**.
Expand All @@ -48,6 +54,8 @@ Next step would be ***\*drum-roll\**** forking the repository!
- Take a look at some of the files to know what I meant by that.
- Never forget to **test and compile** the code first on your machine before such reckless moves!

---

### What to do after writing the code

- Check, test and compile your code into it's appropriate directory.
Expand All @@ -57,14 +65,18 @@ Next step would be ***\*drum-roll\**** forking the repository!
- Fill up the form!
- Wait for me to accept your changes!

---

## Issues

### Create a new issue
### Creating a new issue

If you spotted a problem or would like to create a new issue, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments).

If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/JumperBot/Unsafe-4-Bit/issues/new/choose).

---

### Solve an issue

Scan through our [existing issues](https://github.com/JumperBot/Unsafe-4-Bit/issues) to find one that interests you.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ and [compile](./src/README.md#UFBC) and [run](./src/README.md#UFB) the program!
/*
Write "Hello World" to memory index: 38
*/
wvar 38 8 5 12 12 15 0 23 15 18 12 4
wvar 38 "Hello World"
// Print the variable residing in memory index: 38
print 38
/* Jump to command no. 0
Expand Down
3 changes: 2 additions & 1 deletion build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ java -jar UFB.jar [ -flags ] [ file ]

---

## Example
## Examples

```shell
java UFB -pnv
Expand All @@ -47,4 +47,5 @@ java UFB -nvp
java UFB -pnhv
java UFB -mn
java UFB -c ../test/UFB/Main.ufb
java UFB -b ../test/UFB/Main.ufbb
```
Binary file modified build/UFB.jar
Binary file not shown.
Binary file modified build/UFB/FlagManager.class
Binary file not shown.
Binary file modified build/UFB/Optimizer$1.class
Binary file not shown.
Binary file modified build/UFB/Optimizer.class
Binary file not shown.
Binary file added build/UFB/Runner$1.class
Binary file not shown.
Binary file modified build/UFB/Runner.class
Binary file not shown.
Binary file modified build/UFB/UFB.class
Binary file not shown.
Binary file modified build/UFB/UFBC$1.class
Binary file not shown.
Binary file added build/UFB/UFBC$2.class
Binary file not shown.
Binary file modified build/UFB/UFBC.class
Binary file not shown.
10 changes: 6 additions & 4 deletions build/build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/sh
cd UFB
javac -verbose ../../src/UFB/*.java -d .
echo
jar --create --file=../UFB.jar --verbose --main-class=UFB *.class
echo "javac ../../src/UFB/*.java -d . -Xdiags:verbose"
javac ../../src/UFB/*.java -d . -Xdiags:verbose
echo "jar --create --file=../UFB.jar --main-class=UFB *.class"
jar --create --file=../UFB.jar --main-class=UFB *.class
cd ..

# Copy build/README.md to src/README.md
cp README.md ../src/README.md
echo "cp README.md ../src/README.md"
cp README.md ../src/README.md
3 changes: 2 additions & 1 deletion src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ java -jar UFB.jar [ -flags ] [ file ]

---

## Example
## Examples

```shell
java UFB -pnv
Expand All @@ -47,4 +47,5 @@ java UFB -nvp
java UFB -pnhv
java UFB -mn
java UFB -c ../test/UFB/Main.ufb
java UFB -b ../test/UFB/Main.ufbb
```
34 changes: 31 additions & 3 deletions src/UFB/FlagManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,38 @@

class FlagManager{
final String flagString="[pnmvhclb]";
final String[] longFlagsArr={
"unoptimized"
};
final boolean[] isActivated=new boolean[flagString.length()-2];
final boolean[] isLongActivated=new boolean[longFlagsArr.length];
final String file;
final Pattern flags=Pattern.compile(flagString);
final Pattern repeats=Pattern.compile("(\\w)\\1+");
public FlagManager(final String[]a){
final Pattern flags=Pattern.compile(flagString);
final Pattern longFlags=Pattern.compile(
Arrays.toString(longFlagsArr).substring(1)
.replaceAll("\\]$", "")
.replace(", ", "|")
);
final Pattern repeats=Pattern.compile("(\\w)\\1+");
final Pattern doubleHyphens=Pattern.compile("^-+");
String fileName="";
for(final String s:a){
final String arg=s.trim();
if(arg.endsWith(".ufbb")||arg.endsWith(".ufb"))fileName=arg;
else if(arg.startsWith("-")){
else if(arg.startsWith("--")){
final String arg2=doubleHyphens.matcher(arg).replaceAll("");
if(longFlags.matcher(arg2).matches()){
for(int i=0;i<longFlagsArr.length;i++)
if(longFlagsArr[i].equals(arg2))
isLongActivated[i]=true;
}else
System.out.printf(
"Unrecognized flags found: %s\n%s\n\n",
arg2,
"Continuing anyway..."
);
}else if(arg.startsWith("-")){
final String str=repeats.matcher(arg.replace("-", "")).replaceAll("$1");
final String shouldBeEmpty=flags.matcher(str).replaceAll("");
if(shouldBeEmpty.length()!=0){
Expand Down Expand Up @@ -64,6 +86,12 @@ public boolean isFlagActivated(final char c){
return isActivated[i];
return false;
}
public boolean isLongFlagActivated(final String s){
for(int i=0;i<longFlagsArr.length;i++)
if(longFlagsArr[i].equals(s))
return isLongActivated[i];
return false;
}
public String getFileName(){
return file;
}
Expand Down
Loading

0 comments on commit 29083d8

Please sign in to comment.