STARFinder is a little project to learn Scala, it's built to learn to use features
from Scala, coming from OCaml. The Goal of STARFinder is to use a little
easy language to find bus stop according to rules (ex: all bus stops with the C1 or the C2 and the
underground b is (C1 or C2) and b
).
You can download the latest star-finder.jar
in the releases
tab of github or you can compile the code (see compile)
You can just launch the REPL by running the jar (note: the main code was compiled with OpenJDK 19), switching the providers
by using the --provider "provider"
argument, to see the whole list just run --help
as arguments
To use the language, see examples or the language specification
The current supported backends are
- STAR (Rennes)
- TAN (Nantes)
- TCL (Lyon)
- RTM (Marseilles) (*)
You can run the project with sbt
git clone [email protected]:coco33920/STARFinder.git
cd STARFinder/
sbt "run <arguments>"
To compile the program to a jar just run
git clone [email protected]:coco33920/STARFinder.git
cd STARFinder/
sbt assembly
java -jar target/scala-3.2.0/star-finder.jar <arguments>
The main part of the Scala part of the project is to lex and parse a little language to construct the commands, it supports unicode for multiple way to create the command for example
and
&
-
∩
all lex to the AND
operator,
or
|
∪
+
all lex to the OR
operator and finally
not
¬
lex to the NOT
operator so the commands
(C1 or C2) and b
(C1 | C2) & b
- etc.
all lex to the same token list, and are all parse to the same commands, and naturally you can mix and match if you want for example
(C1 | C2) ∩ b
(C1 or C2) & b
- etc.
The language have three keywords, two uses int as parameters
allow <int>
(see) specify to the interpreter how many "hops" or intermediary stops you're keen to take to find a path between two stops (warning, a huge number means alot
of possible connections) you can also use@ <int>
which is the same keywordshow <int>
is used after a logical command (see) likeC1 or C2 show 5
to limit the number of lines printed to5
you can also uselimit <int>
or<< <int>
which are the same keyword
The last one take a string as parameter
using <str>
takes a string as a list of lines, likeusing C1,a
and limits the starting lines for theto
operators
All keywords can be used in whatever order you like it doesn't matter
You can find paths between two stops with the to
operator, which can be written ->
or →
, and the
allow
keywords specify how many hops you are keen to take, by default it is 0̀
(so a direct connection)
example of usage
Républiques → Gares
Gares → Tournebride allow 1
And many more, enjoy! :)
Java is used to provide an API in the form of an interface, that can be implemented to provide support for multiple backends (STAR, TBM, etc.)
- AST Type
- Parser (Scala)
- Basic Parser
- Applying the not operator for all expressions
- Printing AST
- API (Java)
- Implementation of the database scheme for STAR
- Implementation from the interpreter point of vue
- Fully functioning one implementation (STAR)
- Tests (Scala)
- Interpreter (Translator to SQL) (Scala)
- Command line launch (Scala)
- Cache (Java)
- Better REPL
- Update provider
- Implementing more providers
- Rennes (STAR)
- Paris
- Lyon (TCL)
- Nantes (TAN)
- Marseille (RTM)*
- Lille
- Bordeaux
- Toulouse
- Montpellier
This project is using
- Scala-Test under Apache-2.0 license
- Decline under Apache-2.0 license
- µPickles under MIT license
- os under MIT license
- sql-lite jdbc under Apache-2.0 and BSD license
- apache common-io under Apache-2.0 license
- JLine under BSD license (see JLine disclaimer)
- org.Json in the public domain
- (*) For RTM some stops are under different name and id so the connection doesn't really work out nicely. Might fix