-
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.
- Loading branch information
0 parents
commit 864e405
Showing
5 changed files
with
75 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
Binary file not shown.
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,53 @@ | ||
grammar Project; | ||
|
||
//--------------------------------------------parser-------------------------------------------------------- | ||
start: imports* definationVar*; | ||
imports: importLibrary | importFunction; | ||
importLibrary: VALIDNAME '=' REQUIRE '<' VALIDNAME '>' SEMICOLON; | ||
importFunction : VALIDNAME (',' VALIDNAME)* '=' FROM '<' VALIDNAME '>' (REQUIRE ' <' VALIDNAME '>' | '=>' '<' VALIDNAME '>') (',' FROM ' <' VALIDNAME '>' (REQUIRE '<' VALIDNAME '>' | '=>' '<' VALIDNAME '>' ))* SEMICOLON; | ||
//Defination Var.......................... | ||
definationVar: ACCESSIBILITY? CONST? DATATYPE VALIDNAME ('=' INT|DOUBLE|STRING)? SEMICOLON; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//--------------------------------------------Lexer Rules-------------------------------------------------------- | ||
|
||
|
||
RETURN : 'return'; | ||
REQUIRE : 'require'; | ||
FROM : 'from'; | ||
CONST : 'const'; | ||
DATATYPE : 'int' | 'float' | 'double' | 'string' | 'char' | 'bool'; | ||
ACCESSIBILITY : 'private' | 'public'; | ||
SEMICOLON : ';'; | ||
OPEN_PARANTEZ : '('; | ||
CLOSE_PARANTEZ : ')'; | ||
OPEN_AKOLAD : '{'; | ||
CLOSE_AKOLAD : '}'; | ||
OPEN_KROSHE : '['; | ||
CLOSE_KROSHE : ']'; | ||
BOOL : 'True' | 'False'; | ||
PM : '+' | '-'; | ||
SCIENTIFICSYMBOL : (DIGIT | '0') '.' INT ('e' ('-' | '+')? INT)?; | ||
STRING: '"' TEXT '"'; | ||
INT : DIGIT+; | ||
DOUBLE : INT ('.' INT)?; | ||
VALIDNAME : (LETTER | '$') (LETTER | DIGIT | '_' | '$')+; | ||
fragment TEXT: (LETTER | ' ' | '\t')*; | ||
fragment LOWERCASE : [a-z]; | ||
fragment UPPERCASE : [A-Z]; | ||
fragment LETTER : [a-zA-Z]; | ||
fragment DIGIT : [0-9]; | ||
|
||
// ----------------------------------------Skip Rules----------------------------------------------------- | ||
WS : ( ' ' | '\n' | '\t' | '\r')+ -> skip; | ||
SINGLELINECOMMENT: '//' .*? -> skip; | ||
MULTILINECOMMENT: '/*' .*? '*/' -> skip; | ||
|
||
|
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,4 @@ | ||
آیا همچین چیزی داریم؟ | ||
lib1, lib2 = require math, require animal; | ||
|
||
|
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,7 @@ | ||
lib1 = from<math> require <floor>; | ||
|
||
lib = from <math> require <floor>; | ||
|
||
func = require<math>; | ||
|
||
public const int aa = 10; |