harsath / prism-interpreter Goto Github PK
View Code? Open in Web Editor NEWInterpreter for the Prism programming language
License: MIT License
Interpreter for the Prism programming language
License: MIT License
Requires modification to variable_decl
and expr
. In variable_decl
, we should add ID
to support the CLASS
type (classes are custom type), and initialization of the object of the class.
Currently, we nest multiple IF
s inside an ELSE
block. But support ELIF
for alternative branches.
Ex: RETURN 10 ? i > 5 : 20;
There's an issue where you can access variables in functions that were declared in main. For example:
`FUNCTION INT foo(INT a1, INT a2) {
RETURN a * b;
}
FUNCTION INT main() {
INT a = 15;
INT b = 15;
a = foo(a, b);
RETURN a;
}`
Create a language specification for ANTLR
Basic language features for milestone 1:
The output of our "coverage" will be:
(number of lines covered by test / total number of lines in the source file) * 100
EXAMPLE:
(3 / 5) * 100 = 60, so our test covers 60% of the source file.
Add STRING
type support to grammar.
Finish Jackie's remark on partial conditional coverage. Ex, if only ELSE
block is covered by the test and vice verse, mark the conditional block of IF
statement with yellow color. If both IF
and ELSE
blocks are covered, make it green.
Supporting private
and public
access specifiers for classes (private methods and attributes cannot be called from an instance of the object). But can be called within the class (by helper subroutines).
It requires some modification to our grammar file. For array reference, assignment and usage, we will add a new rule,
ID '[' expr ']'
to expr
parser rule. But we also have to add additional syntax for arrays under variable_decl
to support the declaration and initialization of arrays.
Support Map
data type for internal hashmap. Syntax can be similar to:
Hashmap<KEY_TYPE, VALUE_TYPE> variable = {OPTIONAL_KEY_VALUE_PAIR};
OPTIONAL_KEY_VALUE_PAIR := (KEY, VALUE)*
Currently, we only allow the declaration of classes. But we should also have syntax support for invoking methods and accessing attributes. Requires changes in grammar to support creating new objects and accessing members.
Support postfix addition and subtraction.
Ex: i++
, j--
If someone tries to define an in-built function in their source program, raise an exception saying that Cannot define in-built function FUNCTION_NAME
. We should store a hash table of in-built functions and check if the declaration function's name .contains()
in the hash table, if so, raise an exception. Work should be done in DeclarationExecutor.java
.
Support import
facility to import Prism sources files.
Example, we can have function-implementations.prism
where various functions recides (without main()
) and another test Prism file, ex test-function-implementation.prism
will import
function-implementation.prism
and use variables, functions, and classes from that source file.
Syntax: EXIT(RETURN_STATUS)
. Useful in test method's assertions to exit the program if a test files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.