ted537 / pt20-student Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Add test cases for packages. They mention this quite a bit in the Phase 4 document and I don't believe it directly relates to anyones part so we just need to cover these at the end
Test Name | Purpose |
---|---|
Remove array | Check that removed keywords are not recognized |
Remove begin | |
Remove case | |
Remove const | |
Remove div | |
Remove do | |
Remove mod | |
Remove procedure | |
Remove program | |
Remove type | |
Remove until | |
Add choose | Check that added keywords are recognized |
Add elseif | |
Add fun | |
Add is | |
Add like | |
Add pkg | |
Add public | |
Add using | |
Add val | |
Add when |
Implement changes to @SimpleType to accept new like keyword syntax from string type declaration.
Ex: var str : like "Hello"
Test Name | Purpose |
---|---|
Remove read | Check that old PT Pascal identifiers are no longer recognized |
Remove readln | |
Remove write | |
Remove writeln | |
Replace get | Check that new Like identifiers are recognized |
Replace getln | |
Replace put | |
Replace putln |
Make fails when the lib/
and bin/
folders do not exist. The Makefiles assume that they exist but may be empty.
lib/
and bin/
such that git keeps track of themlib/
and bin/
, probably via mkdir
Test Name | Purpose |
---|---|
Add slash("/") | Check that new characters classes are recognized by scanner |
Add percent("%") | |
Add hash("#") | |
Add bang("!") | |
Add or bar("|") | |
Add double or bar ("||") | |
Add plus equals ("+=") | |
Add minus equals ("-=") | |
Add star equals ("*=") | |
Add slash equals ("/=") | |
Add percent equals ("%=") | |
Add double equals ("==") |
Test Name | Purpose |
---|---|
Double Quotes | Check that scanner recognizes double quotes instead of single quotes |
Valid String | Test a regular string with double quotes |
Null String | Test a null string |
Single quote string | Check that single quotes are not valid for strings anymore |
Other invalid strings | Check other invalid string (EOF, Newline) [OPTIONAL] |
Single line comments | Check single line comments (// to end of line) |
Multi-line comments | Check multi line comments (/* to */) |
Example unary operators
val str_length = #str
or val str_length = #"Hello"
The output of the parser for these statements is:
.sConst .sIdentifier .sIdentifier .sLength
The semantic analyzer reads both of these identifiers through @ConstDefinition and @operand. Then call is made to @unaryoperator where .sLength is recognized. Put type integer (since length is integer) on the type stack. Then call made to @CompareAndSwapTypes which tries to compare the top two types on the type stack to ensure it can be set.
The idea for this is to ensure that the identifier to be set is the same type as the value being set. Ex. When setting a variable x to a string we need to ensure that x can take a string.
What happens though with the @CompareAndSwapTypes is that it compares to the identifier attached to the unary operator. So for val str_length = #str
an integer is placed on the type stack (since length is integer). Then it is compared with the identifier str
which is a string literal. So matching fails in @CompareAndSwapTypes.
Changes in parser.ssll to add .sLength ouput token when used in constant defintion. Around line 370 with pHash.
The code should output errors when we try to do something illegal( i.e. substring with non-integer values) so we need to create some tests that are intended to create an error.
They really liked this from last time. If you look at the semantic test cases for string operations I cover this. As long as we do a few for string operations and maybe some other operations we should be good to get full marks
Need to make sure all test cases are in their own files (ex. + - should have their own test files).
Test the changes to file names in AssignProcedures
Modify the Program rule in parser.ssl
to match the Like specification
working on initial values, code is in initialValues branch. the test can be run using:
ssltrace "ptc -o4 -t4 -L lib/pt test/coder/initial-values/initial-integer.pt" lib/pt/coder.def
The semantic phase prints out the correct token stream for the initial value but when the coder analyzes the stream, it is skipping over the tStoreInteger which should be the expected token
scan.ssl
output tokens into parser.ssl
input tokensparser.ssl
output token sType
with sLike
parser.ssl
output tokens
sPackage
sPublic
sConcatenate
sRepeatString
sSubstring
sLength
sInitialValue
sCaseElse
To Do
Tests needed
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.