-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from X-R-G-B/dev
Dev
- Loading branch information
Showing
88 changed files
with
6,096 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Leviator BNF | ||
|
||
```bnf | ||
<syntax> ::= <expression>* | ||
<expression> ::= <alias> | <function> | <comment> | ||
<alias> ::= "alias " <identifierAlias> " " <replacement> ";\n" | ||
<identifierAlias> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | | ||
"J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | | ||
"S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | | ||
"b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | | ||
"k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | | ||
"t" | "u" | "v" | "w" | "x" | "y" | "z" | "0" | "1" | | ||
"2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "_" | | ||
"." | "-" | ":" | "!" | "@" | "#" | "$" | "%" | "^" | | ||
"&" | "*" | "(" | ")" | "[" | "]" | "{" | "}" | "|" | | ||
"\\" | "+" | "=" | ";" | "<" | ">" | "?" | "/" | "`" | | ||
"~" | ||
<replacement> ::= <char2> | ||
<comment> ::= "//" <char1>* "\n" | ||
<function> ::= "fn " <identifier> "(" <parameterList>* ") -> " <type> "\n{\n" <instruction>* "}\n" | ||
<identifier> ::= <lowerLetter> <char2> | ||
<parameterList> ::= <parameter> "," | ||
<parameter> ::= <identifier> ": " <type> | ||
<type> ::= <upperLetter> <char2> | ||
<instruction> ::= <instructionIns> ";\n" | ||
<instructionIns> ::= <declaration> | <assignment> | <functionCall> | <return> | <condition> | ||
<declaration> ::= "@" <type> " " <identifier> " = " <value> | ||
<assignment> ::= <identifier> " = " <value> | ||
<functionCall> ::= <identifier> "(" <varParamList>* ")" | ||
<varParamList> ::= <value> "," | ||
<return> ::= "<- " <value> | ||
<value> ::= <functionCall> | <identifier> | <literal> | ||
<literal> ::= <digit> | <character> | <bool> | <stringview> | ||
<condition> ::= <conditionIf> | <conditionIfElse> | ||
<conditionIfElse> ::= <conditionIf> <conditionElse> | ||
<conditionIf> ::= "if (" <value> ")\n{\n" <instruction>* "}\n" | ||
<conditionElse> ::= "else\n{\n" <instruction>* "}\n" | ||
<character> ::= "'" <char1> "'" | ||
<bool> ::= "True" | "False" | ||
<stringview> ::= "\"" <char1>* "\"" | ||
<char> ::= <lowerLetter> | <upperLetter> | <digit> | ||
<char1> ::= <char> | "" | " " | <specialAll> | ||
<char2> ::= <lowerLetter> | <upperLetter> | <digit> | <special> | ||
<lowerLetter> ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | | ||
"j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | | ||
"s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | ||
<upperLetter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | | ||
"J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | | ||
"S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | ||
<digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | ||
<special> ::= "_" | ||
<specialAll> ::= <special> | "!" | "@" | "#" | "$" | "%" | "^" | "&" | | ||
"*" | "(" | ")" | "[" | "]" | "{" | "}" | "|" | "\\" | | ||
"+" | "=" | ";" | "<" | ">" | "?" | "/" | "`" | "~" | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Leviator Lang Extension for Visual Studio Code | ||
|
||
We are thrilled to introduce our Leviator lang extension, providing enhanced syntax highlighting for an optimized coding experience. While currently available exclusively for vscode, we have ambitious plans to extend support to JetBrains and Vim in the future. | ||
|
||
### Installation | ||
|
||
To install the Leviator Language extension for **Visual Studio Code**, follow the steps below: | ||
|
||
1. Navigate to the "lvtext" directory in our [Leviator GitHub repository](https://github.com/X-R-G-B/Leviator/lvtext). | ||
2. Refer to the detailed installation instructions provided in the [README.md](https://github.com/X-R-G-B/Leviator/blob/lvtext/vscode/leviator-lang/README.md) file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{- | ||
-- EPITECH PROJECT, 2023 | ||
-- Leviator compiler | ||
-- File description: | ||
-- Args | ||
-} | ||
|
||
|
||
module Args | ||
( | ||
Action(..), | ||
Args(..), | ||
parseArgs, | ||
printHelp | ||
) where | ||
|
||
import System.Directory (getCurrentDirectory) | ||
|
||
data Action = ShowHelp | ShowVersion | Run | ||
|
||
data Args = Args { | ||
action :: Action, | ||
folderPath :: String, | ||
outFile :: String, | ||
verbose :: Bool | ||
} | ||
|
||
parseArgs' :: [String] -> Args -> Either Args String | ||
parseArgs' [] args = | ||
Left args | ||
parseArgs' ("--help":xs) args = | ||
parseArgs' xs (args {action = ShowHelp}) | ||
parseArgs' ("-h":xs) args = | ||
parseArgs' xs (args {action = ShowHelp}) | ||
parseArgs' ("--version":xs) args = | ||
parseArgs' xs (args {action = ShowVersion}) | ||
parseArgs' ("-v":xs) args = | ||
parseArgs' xs (args {action = ShowVersion}) | ||
parseArgs' ("-o":x:xs) args = | ||
parseArgs' xs (args {outFile = x}) | ||
parseArgs' ["-o"] _ = | ||
Right "Missing argument for -o" | ||
parseArgs' ("--verbose":xs) args = | ||
parseArgs' xs (args {verbose = True}) | ||
parseArgs' (('-':xs):_) _ = | ||
Right ("Unknown option: " ++ xs) | ||
parseArgs' (x:xs) args = | ||
parseArgs' xs (args {action = Run, folderPath = x}) | ||
|
||
parseArgs :: [String] -> IO (Either Args String) | ||
parseArgs args = | ||
getCurrentDirectory >>= \path -> | ||
return (parseArgs' args (Args { | ||
action = Run, folderPath = path, outFile = "out.wasm", verbose = False | ||
})) | ||
|
||
hLine1 :: String | ||
hLine1 = "Usage: lvtc [OPTION] [FOLDER]\n" | ||
hLine2 :: String | ||
hLine2 = "\n" | ||
hLine3 :: String | ||
hLine3 = "Compile Leviator source code to WebAssembly\n" | ||
hLine4 :: String | ||
hLine4 = "" | ||
hLine5 :: String | ||
hLine5 = "Options:\n" | ||
hLine6 :: String | ||
hLine6 = "\t-h, --help\n\t\tDisplay this help and exit\n" | ||
hLine7 :: String | ||
hLine7 = "\t-v, --version\n\t\tOutput version information and exit\n" | ||
hLine8 :: String | ||
hLine8 = "\t-o FILE\n\t\tWrite WebAssembly to FILE\n" | ||
hLine9 :: String | ||
hLine9 = part1 ++ part2 | ||
where | ||
part1 = "\tFOLDER\n\t\tTake all Leviator" | ||
part2 = " source code recursively from FOLDER\n" | ||
hLine10 :: String | ||
hLine10 = "\t--verbose\n\t\tVerbose mode\n" | ||
|
||
printHelp :: IO () | ||
printHelp = | ||
putStr hLine1 >> putStr hLine2 >> putStr hLine3 >> putStr hLine4 | ||
>> putStr hLine5 >> putStr hLine6 >> putStr hLine7 >> putStr hLine8 | ||
>> putStr hLine9 >> putStr hLine10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.