Git Product home page Git Product logo

pt20-student's People

Contributors

16cmc21 avatar brennanmosher avatar ted537 avatar willmacd avatar

Stargazers

 avatar  avatar

Watchers

 avatar

pt20-student's Issues

Package test cases

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

Add parser tests for keywords

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

String Like declarations

Implement changes to @SimpleType to accept new like keyword syntax from string type declaration.
Ex: var str : like "Hello"

Add parser tests for identifiers

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

Fix lib and bin issues with make

Description

Make fails when the lib/ and bin/ folders do not exist. The Makefiles assume that they exist but may be empty.

Possible Solutions

  • Add an arbitrary file to both lib/ and bin/ such that git keeps track of them
  • Edit Makefiles to automatically create lib/ and bin/, probably via mkdir

Add parser tests for character classes

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 ("==")

Add miscellaneous parser tests

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 */)

String Length Unary Operator

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.

Add error test cases

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

Organize test cases

Need to make sure all test cases are in their own files (ex. + - should have their own test files).

Phase 2: Programs

Modify the Program rule in parser.ssl to match the Like specification

coder is skipping tStoreInteger token in semantic stream and looking for tWriteBegin instead

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

Phase 2: Token Definitions

  • Copy scan.ssl output tokens into parser.ssl input tokens
  • Replace parser.ssl output token sType with sLike
  • Add parser.ssl output tokens
    • sPackage
    • sPublic
    • sConcatenate
    • sRepeatString
    • sSubstring
    • sLength
    • sInitialValue
    • sCaseElse

String Operations

To Do

  • Fix assertion errors in String length
  • Add support for string literal comparisons (sEq, sNEq)

Tests needed

  • Test all operations (*, /, %). These are needed since an issue was found with types not being linked to their std type in the semantic.ssl file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.