Coder Social home page Coder Social logo

pariasrz / galaxy-compiler Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 15 KB

Lexical Analyzer and Parser implementation for a programming language named Galaxy

Python 100.00%
parser parsing-table lexical-analyzer lexer ll1-grammar ll1-parser programming-language compiler syntax-analyzer

galaxy-compiler's Introduction

Galaxy-Compiler

Lexical Analyzer and Parser for a programming language named Galaxy based on a LL1 grammar which you can find Here

Here are the rules for this programming language:

  • Integer:
protostar x := 15 %

A protostar is a star in it's early stages.

  • Float:
star x := 15.5 %
  • String:
planet x := ' Hello World ' %
  • Character: stating a character would be like this:
asteroid x := 'Hi' %

Note that asteroid is a minor planet.

  • Array: we can define a multi-dimensional array of objects with "cluster DataType ArrayName , Size , SizeOfEachElement %":
cluster protostar x , 10 , 5 %

Note that Star Cluster is a big group of stars.

  • Loop structure:
ring ( condition )
	statement1 %
	statement2 %
	...
  • Conditional structure:
nebula ( condition )
	statement1 %
	statement2 %
     ...

A Nebula is an interstellar cloud of dust and gases where stars are born, so you can define conditions for the stars you want to create!

  • Comment:
    • Single-line comment can be followed by ||:
     || a comment
    
    • Multi-line comment block:
     |.
     comment1
     comment2
     ...
     .|
    
  • Operators: This is very simple: Expression OPERATOR Expression. For example:
x + y 
x // y

Each Operator definition can be found in Delimiters and Operators

galaxy-compiler's People

Contributors

pariasrz avatar

Stargazers

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