Skip to content

Lexical Analyzer and Parser implementation for a programming language named Galaxy

Notifications You must be signed in to change notification settings

Pariasrz/Galaxy-Compiler

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages