Skip to content

Scala Learning Project : Find a bus/metro/tram stop with *logic* !

License

GPL-3.0, Unknown licenses found

Licenses found

GPL-3.0
LICENCE
Unknown
LICENCE-jline.md
Notifications You must be signed in to change notification settings

coco33920/STARFinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STARFinder Scala Test CI

Language - Scala Licence Tag


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).

Usage

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

Current Providers

The current supported backends are

  • STAR (Rennes)
  • TAN (Nantes)
  • TCL (Lyon)
  • RTM (Marseilles) (*)

Run

You can run the project with sbt

git clone [email protected]:coco33920/STARFinder.git
cd STARFinder/
sbt "run <arguments>"

Compiling

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 Language

Finding bus stops

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.

Keywords

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 a lot of possible connections) you can also use @ <int> which is the same keyword
  • show <int> is used after a logical command (see) like C1 or C2 show 5 to limit the number of lines printed to 5 you can also use limit <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, like using C1,a and limits the starting lines for the to operators

All keywords can be used in whatever order you like it doesn't matter

Finding paths between stops

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 (so a direct connection) example of usage

  • Républiques → Gares
  • Gares → Tournebride allow 1

Examples

Help menu

help

All STAR stops with the C1 and the metro (a or b)

image

Direct connections between Gares and République

image

Itineraries between Gare and Tournebride using only the a from Gares

image

And many more, enjoy! :)

The Providers (not implemented yet)

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.)

TODO List

  • 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

Libraries

This project is using

Other

  • (*) For RTM some stops are under different name and id so the connection doesn't really work out nicely. Might fix

About

Scala Learning Project : Find a bus/metro/tram stop with *logic* !

Resources

License

GPL-3.0, Unknown licenses found

Licenses found

GPL-3.0
LICENCE
Unknown
LICENCE-jline.md

Stars

Watchers

Forks

Packages

No packages published

Languages