Giter Club home page Giter Club logo

sharpset's Introduction

Repository logo

Sharpset

Compiler for a Set Theory language, written in C#

Repo size License


Language definitions

ANTLR4: The grammar of this project is defined inside the SetTheory.g4

Assignation & Variables

Assigns a set to a variable, or a variable to a variable.

Example

  • a = [6,2] → assign the set [6,2] to a
  • c = a → assigns the value of the variable a to the variable c (a must be defined)

show

Prints the value of a variable.

Example

  • a = [2]
    show a → prints [2]

set

Creates a set based on three parameter:

  • from: The number where the set will start from
  • to: The number where the set will end - the jump
  • jump: Steps

Example

  • b = set(10,50,2) → create a set from 10 to 50 with a jump of 2: [10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48]

max

Returns the max value from a set.

Example

  • a = [1,9]
    max a → returns [9]

min

Returns the min value from a set.

Example

  • a = [1,9]
    min a → returns [1]

avg

Returns the avg value from a set.

Example

  • a = [1,9]
    avg a → returns [5]

int

Returns the intersection between two sets.

Example

  • a = [1,9]
    b = [2,9]
    int a,b → returns [9]

uni

Returns the union between two sets.

Example

  • a = [1,9]
    b = [2,9]
    uni a,b → returns [1,9,2]

ext

Removes a value from a set, based on the following parameters:

  • variable: The variable containing the set
  • index: The index number of the set that will be removed. Consider the set as an array where the index 0 is the first element

Example

  • a = [1,5,9]
    ext a,0 → removes the first element from the set, so, the result will be the set without that element → [5,9]

len

Returns the length (number of elements) of a set.

Example

  • a = [1,2,3]
    len a → returns [3]

add

Adds an element to a set.

Example

  • a = [1,9]
    add a,4 → returns [1,9,4]

del

Deletes an element from a set.

Example

  • a = [1,9]
    del a,9 → returns [1]

Examples

Inside the SetTheoryCompiler Project, there is a Program.cs file that contains many examples of how the different operations work.


License

MIT

sharpset's People

Contributors

lhbelfanti avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.