Skip to content

Commit

Permalink
Update of my thesis
Browse files Browse the repository at this point in the history
  • Loading branch information
szabototo89 committed May 1, 2014
1 parent dc925c7 commit e2ebfc9
Show file tree
Hide file tree
Showing 34 changed files with 2,005 additions and 0 deletions.
Binary file modified docs/Diplomamunka_Szabo_Tamas.docx
Binary file not shown.
Binary file added docs/Diplomamunka_Szabo_Tamas.pdf
Binary file not shown.
Binary file modified docs/graphics/szintaxisfa.vsdx
Binary file not shown.
Binary file added docs/graphics/~$$szintaxisfa.~vsdx
Binary file not shown.
Binary file added docs/~$akdolgozat_kovetelmenyek.docx
Binary file not shown.
56 changes: 56 additions & 0 deletions grammar-imperative/Imperative.g4
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
grammar Imperative;

init: (statement)+;
//| functionDefinition
//| macroDefinition)*;

statement : skip
| assignment
| functionCall
| ifStatement
| loopStatement
;

skip : 'skip'
;

assignment : ID ':=' expression
;

ifStatement : 'if' '(' expression ')' 'then' statement+ 'endif'
;

loopStatement : 'loop' '(' expression ')' 'do' statement+ 'end' 'loop'
;

functionCall : ID '(' actualParameters ')'
;

actualParameters : expression (',' expression)*
;

expression : constant
| ID
| functionCall
| ('not' | '-') expression
| expression ('+'|'-'|'/'|'*'|'<'|'<='|'>'|'>='|'=='|'!='|'and'|'or') expression
;

constant : NUMBER | BOOLEAN | STRING
;

BOOLEAN : 'false' | 'true'
;

STRING : '"' .*? '"'
;

NUMBER : [0-9]+('.'[0-9]+)*
;

ID : ('_'|[a-zA-Z]) ([a-zA-Z0-9]|'_')*
;

WHITESPACE : [ \t]+ -> skip;

NEW_LINE : '\r'? '\n' -> skip;
23 changes: 23 additions & 0 deletions grammar-imperative/MetaCodeLexer.g4
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]
;
7 changes: 7 additions & 0 deletions grammar-imperative/example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
print("Program futásának kezdete ...")
i := 0
loop (i < 10) do
print(toString(i) + " sor: ")
i := i + 1
end loop
print("Program futásának vége.")
Loading

0 comments on commit e2ebfc9

Please sign in to comment.