-
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.
Added a new prototype file to MetaCode
- Loading branch information
1 parent
3434e97
commit e308b58
Showing
5 changed files
with
68 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
lexer grammar MetaCodeLexer; | ||
|
||
WHITESPACE : [ \t]+ -> skip | ||
; | ||
NEWLINE : [\r]? [\n] -> skip | ||
; | ||
|
||
NUMBER : INT | ||
| FLOAT | ||
; | ||
|
||
fragment | ||
INT : DIGIT+ | ||
; | ||
|
||
fragment | ||
FLOAT : DIGIT+ [.] DIGIT* | ||
| [.] DIGIT+ | ||
; | ||
|
||
fragment | ||
DIGIT : [0-9] | ||
; |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
545 | ||
18. | ||
18. | ||
.8 | ||
3.14 |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
example = if ARGV[0].nil? | ||
File.open("example.txt", "w") if not File.exist?("example.txt") | ||
"example.txt" | ||
else | ||
ARGV[0].to_s | ||
end | ||
puts "Running MetaCode parser ..." | ||
Dir.mkdir("src") if not Dir.exists? "src" | ||
Dir.chdir("src") | ||
system('call antlr4 "../MetaCode.g4" -visitor') | ||
system('call grun MetaCode init -gui ..\\' + example) | ||
example = if ARGV[0].nil? | ||
File.open("example.txt", "w") if not File.exist?("example.txt") | ||
"example.txt" | ||
else | ||
ARGV[0].to_s | ||
end | ||
puts "Running MetaCode parser ..." | ||
Dir.mkdir("src") if not Dir.exists? "src" | ||
Dir.chdir("src") | ||
system('call antlr4 "../MetaCode.g4" -visitor') | ||
system('call grun MetaCode init -gui ..\\' + example) |
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,25 @@ | ||
selector class-methods = class > method | ||
selector if-conditions = if > condition | ||
selector class-by-name[className] = class[name=className] | ||
|
||
macro printMethods(methods: class > method[name="func*"]) : * do | ||
foreach (method in methods) do | ||
Console.WriteLine(method.text) | ||
end | ||
methods | ||
end | ||
|
||
//default return 'type' : * | ||
macro negateConditionsOfIf(condition : if-conditions) do | ||
|
||
end | ||
|
||
macro negateConditionsOfIf(condition : if > condition) : if do | ||
|
||
end | ||
|
||
macro generateToStringMethod(c : class) : class do | ||
(c > method).addMethod({ | ||
public function toString() : String = c.name | ||
}) | ||
end |