rscript in a nutshell rscript examples
play

Rscript in a Nutshell Rscript: examples Set: Basic types: - PowerPoint PPT Presentation

Rscript in a Nutshell Rscript: examples Set: Basic types: , , , (text location in specific file with comparison operators) type:


  1. Rscript in a Nutshell Rscript: examples ● Set: ��������� ● Basic types: ���� , ��� , ��� , ���� (text location in specific file with comparison operators) � – type: �������� ● Set: �������������� ● Sets, relations and associated operations (domain, range, inverse, projection, ...) � – type: �������� ● Relation: ���������������������������� ● Comprehensions ● User-defined types – type: ������������ ● Fully typed ● Functions and sets of equations over the above Introduction to ASF+SDF Introduction to ASF+SDF Rscript: examples Comprehensions ● ���������������������������������������������� ● Comprehensions: �"�#�$�%��&��%��'��(((�� ● �������������� domain: – A generator is an enumerator or a test all elements in lhs of pairs – Enumerators: )�*�+��"�# or �)&�)'��*�,��"�# – � range: all elements in rhs of pairs ● ��������������������������� � – Tests: any predicate carrier: – consider all combinations of values in %��&��%��'�((( all elements in lhs or rhs – ������������������������������ of pairs – if some %�� � is false, reject that combination ● ������������� ����� !����� � – compute "�# for all legal combinations – ��������������� Introduction to ASF+SDF Introduction to ASF+SDF

  2. Comprehensions Functions ● �-�$�����-�*��&�'���.���� ● �������������������������������,��� ���/��-��$������-������/��*�,�� – yields �&�'���.��� – �����&�&0����'�'0��� yields ��&0�&���'0�'�� ● �-�$�����-�*��&�'���.�����-����� ● ����12��13����������13��12��,���������������������������� – yields �.��� ���/��-��$��13�-��12�/��*�,� ● ��/��-��$������-������/��*���&�&0���'�'0��� – ������&��!�����'�������� yields ���!��&�������'�� – yields ��&0�&���'0�'�� 13 , 12 indicate any type and are used to define polymorphic functions Introduction to ASF+SDF Introduction to ASF+SDF Toy program Toy program �������������:";+�����&�����������������.��������������� ��4�������!�����*��!�5�!�����*��!�5�!��� ��4�������!�����*��!�5�!�����*��!�5�!��� ��*��!�5�!�6 ��*��!�5�!�6 � is undefined ��*����6 �&� ��*����6 �7����������8�� �'� ��������������+"+������������������������������ �7����������8�� ��*����9�� ��� ��*����9�� ���� ���� ��*��. � may be undefined �.� ��*��. �������������<,":�����0�&����&�'����'�����'�.��� 7� 7� �������.���� ��*��� ��� ��*��� ��� ��� Introduction to ASF+SDF Introduction to ASF+SDF

  3. Intermezzo: ��!�8- Finding uninitialized variables Start of program ● Reachability with exclusion of certain elements Along these path, we encounter ● ����1=����!�8-� a definition – ����1=��+�!���� Def 2 of x Def 1 of x ' – ����1=��"����� Along this path, we can & . reach a use without passing – ����1=�1=��,��� � a definition � ● ��!�8-��&����'�����&�'���&�����'�.�����.��� Use of x yields ����.�� Value of x may be undefined here Introduction to ASF+SDF Introduction to ASF+SDF The undefined query Applying the undefined query �������������:";+���((( Start from the root ��4�������!�����*��!�5�!�����*��!�5�!��� ��������������+"+���((( ��*��!�5�!�6 �������������<,":���((( Exclude all definitions of ) �&� ��*����6 � is undefined �'� �7����������8�� ��������������>?>?=��� ��� ��*����9�� ���>�)��$������>������)�*�+"+��>������!�8-��0���:";+�@�)��<,":�� � may be undefined ���� �.� ��*��. 7� Result: ��� ��*��� Use the <,": relation There is a path from the root ��� to > : ) is not initialized ������������������ Reach exclude Introduction to ASF+SDF Introduction to ASF+SDF

  4. Use locations to connect with the Some Questions source text ● There are several additional questions: �������������:";+���((( – In the example so far we have worked with statement ��������������+"+���((( Use location instead of number �������������<,":���((( numbers but how do we make a connection with the source text? – How do we extract relations like <,": and �+" �������������:";+ ��������������+"+ from the source text? �������������<,": ��������������ABB�,+ Variable occurrence in a statement Introduction to ASF+SDF Introduction to ASF+SDF Example Rstore Extracting Facts ������� ● Goal: extract facts from source code and use as �<,":��������������� ��!��!@��@7����CD8� �D(((D��! #��(#���C��!��!�.��'�.��E�E.��F���� input for queries !��!@��@7����CD8� �D(((D��! #��(#���C��!��!����'����E�G.��F����� �!��!@��@7����CD8� �D(((D��! #��(#���C��!��!����'����E��G.��F���� ● How should fact extraction be organized? !��!@��@7����CD8� �D(((D��! #��(#���C��!��!�F��'�&0��.��&0.���F���� (((���� ● How to write a fact extractor? �:";+��� �ABB�,+��������������� ��C�C��!��!@��@7����CD8� �D(((D��! #��(#���C�!��!�&&��'�&&����&F.��&���� �C�C��!��!@��@7����CD8� �D(((D��! #��(#���C��!��!�&&��H�&&��E�&FG��&���� (((��� �� � � Introduction to ASF+SDF Introduction to ASF+SDF

Recommend


More recommend