<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://lara.epfl.ch/w/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://lara.epfl.ch/w/feed.php">
        <title>LARA: Laboratory for Automated Reasoning and Analysis compilation</title>
        <description></description>
        <link>https://lara.epfl.ch/w/</link>
        <image rdf:resource="https://lara.epfl.ch/w/lib/tpl/epflv2/images/favicon.ico" />
       <dc:date>2026-06-10T12:42:15+0200</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/abstract_syntax_of_while?rev=1221432355&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/accessing_and_storing_variables?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/ahoullman?rev=1255269393&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/algorithm_for_first_and_follow_sets?rev=1223123415&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/alternatives_to_compilation?rev=1220864856&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/an_efficient_functional_map?rev=1223858806&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/an_efficient_imperative_map?rev=1223858901&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/applications_of_data-flow_analysis?rev=1227622345&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/arm_architecture?rev=1228664137&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/array_manipulation?rev=1225675870&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/automata_for_lr_parsing_without_lookahead?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/booleans_and_data_representation?rev=1226259463&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/bottop-up_type_checking?rev=1224245578&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/branching_jvm_instructions?rev=1226307790&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/building_a_pretty_printer?rev=1223280389&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/building_ll_parsing_table?rev=1223279555&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/cafebabe-abc?rev=1321881443&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/cafebabe-examples?rev=1321881454&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/cafebabe?rev=1321881431&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/charstream.scala?rev=1221061003&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/collatz.while?rev=1221172494&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compilation_as_tree_transformation?rev=1226281396&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiled_counting_examples?rev=1225580466&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiled_expression_examples?rev=1225579524&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiled_factorial_example?rev=1225564145&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiler_construction_by_niklaus_wirth?rev=1226072752&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiler_construction_tools?rev=1220968138&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiler_interface_to_garbage_collector?rev=1229301688&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compilers_in_action?rev=1225543793&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiling_conditional_expressions?rev=1227079652&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiling_if_then_else?rev=1226264230&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiling_statement_sequence?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/compiling_while?rev=1226266493&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/computing_labels?rev=1226263834&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/concrete_execution_as_data-flow_analysis?rev=1227628831&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/concrete_syntax_of_while?rev=1222695924&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/concreteanalysis.scala?rev=1227491478&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/constant_propagation?rev=1226886205&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/constraint-based_type_checking?rev=1225272557&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/control-flow_graph_definition?rev=1227087842&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/control-flow_graph_to_assembly_with_global_variables?rev=1228684180&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/copying_garbage_collector?rev=1229297118&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/course_information?rev=1225557041&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/cyk_parsing_algorithm?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/dataflowanalysis.scala?rev=1258916043&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/designing_correct_data-flow_analyses?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/digraphs.scala?rev=1227491299&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/earley_parser?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/efficient_comparison_for_identifiers?rev=1223876917&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/efficiently_emitting_code?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/elanguage?rev=1228919509&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/evaluating_postfix?rev=1225651343&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/ex3-javacc-stub?rev=1222872752&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/example_efficient_code_for_conditionals?rev=1226279353&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/example_ocamlyacc_grammar?rev=1223237686&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/examples_of_compiled_java?rev=1225579969&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_01?rev=1221642973&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_02?rev=1222242422&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_03?rev=1222872786&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_04?rev=1223468292&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_05?rev=1224661015&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_06?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_07?rev=1225746061&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_08?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_09?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/exercises_session_06?rev=1224675343&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/final_projects_and_reports?rev=1230981627&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/free_lists_by_size?rev=1229287414&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/from_stack_to_register_machines?rev=1226073328&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/functional_versus_imperative_maps?rev=1223855697&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/generational_garbage_collectors?rev=1229298638&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/hand-written_scanner_for_while_language?rev=1221466163&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/handling_scopes_in_interpreters?rev=1223894103&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/higher-order_functions?rev=1228677784&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/idea_of_data_flow_analysis?rev=1227087782&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/idea_of_garbage_collection?rev=1260745986&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/implementing_finite_state_machines?rev=1222190088&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/incremenatal_garbage_collectors?rev=1229301293&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/initialization_analysis?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/instruction_selection?rev=1228703530&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/internal?rev=1229450488&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/internal_grading?rev=1222867639&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/interpreter.scala?rev=1222428116&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/interpreting_cfg?rev=1226884731&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/interpreting_control-flow_graphs?rev=1226505616&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/interpreting_ll_parsing_table?rev=1223148668&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/isquares.while?rev=1223145604&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/jahobparser.yy?rev=1223237708&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/java_definite_assignments?rev=1227635421&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/java_example_for_semantic_analysis?rev=1223875320&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/javacc?rev=1221154193&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/jvm_classfile_construction_library?rev=1225674639&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/jvm_instructions?rev=1225678855&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/jvm_spec?rev=1353453872&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab02-compiler.scala?rev=1222427955&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab02-factorial.java?rev=1222196814&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab02-lexer.scala?rev=1222427938&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab02-main.scala?rev=1222428057&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab02-positional.scala?rev=1222427873&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab02-reporter.scala?rev=1222427805&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab02-tokens.scala?rev=1222428012&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab04-compiler.scala?rev=1223425915&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab04-main.scala?rev=1223425853&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab04-parser.scala?rev=1223468438&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab04-prettyprinter.scala?rev=1223425767&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab04-tokens.scala?rev=1223424449&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab04-trees.scala?rev=1223424667&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab06analyzer?rev=1224650684&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab06compilerstub?rev=1224651293&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab06mainstub?rev=1224651327&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab06symbols?rev=1224656931&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab06treeprinter?rev=1224651259&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab06trees?rev=1224650904&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab08-compiler?rev=1225248287&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab08-typechecker?rev=1225249441&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab08-types?rev=1225248761&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab09-codegen?rev=1226334208&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab09-compiler?rev=1226334293&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab09-main?rev=1226334324&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab11-asttocfgstub?rev=1227632355&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab11-cfg?rev=1227632034&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab11-cfgtrees?rev=1227632058&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab11-compmods?rev=1227633409&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab11-dfa?rev=1228283230&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab11-labeleddirectedgraph?rev=1228283110&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab11-lattices?rev=1228283189&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lab11-ldg?rev=1227631999&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_01?rev=1221631958&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_02?rev=1222418471&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_03?rev=1222689398&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_04?rev=1223644797&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_05?rev=1223681645&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_06?rev=1225818214&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_07?rev=1225134125&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_08?rev=1225876827&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_09?rev=1227534833&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_10?rev=1225734511&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_11?rev=1227640993&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_12?rev=1228329612&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_13?rev=1228387299&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/labs_14?rev=1225734786&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lambda_calculi_with_types?rev=1224609207&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lambda_calculus?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/languages_using_prefix_or_postfix_only?rev=1225651259&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lattices.scala?rev=1227491406&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lattices_in_dataflow_analysis?rev=1226886832&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_01?rev=1221479138&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_02?rev=1222250781&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_03?rev=1222690845&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_04?rev=1223237935&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_05?rev=1255613910&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_06?rev=1225017723&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_07?rev=1225555255&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_08?rev=1225710300&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_09?rev=1226336560&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_10?rev=1227617320&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_11?rev=1227617299&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_12?rev=1227636773&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_13?rev=1228703602&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_14?rev=1229332211&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lecture_15?rev=1227621528&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lexer.scala?rev=1222606521&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lexerinterface.scala?rev=1221080713&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lexertest.scala?rev=1221159683&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/limitations_of_regular_expressions?rev=1222202285&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/linearizing_trees_with_control-flow?rev=1226238656&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/links?rev=1219520499&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/live_variable_analysis?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/ll_parser_uses_leftmost_derivation?rev=1223226307&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/llvm-intro?rev=1322840329&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/local_higher-order_and_dispatched_procedures?rev=1228699748&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lr_0_parser_actions?rev=1223234956&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lr_1_parser_actions?rev=1223739788&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lr_parser_runs_automaton_over_stack?rev=1223229190&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lr_parser_uses_rightmost_derivation?rev=1223226333&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lr_parsing_tables?rev=1223240037&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/lr_parsing_with_lookahead_items?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/main.scala?rev=1222428161&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/malloc_and_free?rev=1229279034&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mallocfree.scala?rev=1229277214&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mallocinfmem.scala?rev=1229277262&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/manual_translation_into_bytecode?rev=1226684768&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/maps_in_math?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mark_and_sweep_collector?rev=1229301723&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/memory_fragmentation?rev=1229288810&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/memory_layout_for_compiled_program?rev=1228691927&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/method_calls?rev=1226227802&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/minijava?rev=1221839774&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/minijava_compiler_project?rev=1222351374&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/minijavaplus?rev=1225872842&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/minijavaplustyperules?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mjp-binarysearch?rev=1222422914&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mjp-binarytree?rev=1222428622&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mjp-bubblesort?rev=1222428345&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mjp-factorial?rev=1222422876&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mjp-linearsearch?rev=1222428532&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mjp-linkedlist?rev=1222428575&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mjp-quicksort?rev=1222428491&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/mjp-treevisitor?rev=1222428388&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/modifying_parser_to_construct_trees?rev=1223145823&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/multiway_branches?rev=1225675157&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/note_on_polymorphism_and_subtyping?rev=1225057234&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/notion_of_hash-consing?rev=1223862621&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/notion_of_subtyping?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/notion_of_syntax_trees?rev=1223280057&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/object_and_reference_manipulation?rev=1225675578&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/official_course_description?rev=1217239790&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/operational_semantics_of_lambda_with_letrec?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/overview_of_an_optimizing_compiler?rev=1258927725&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/overview_of_classfile_constant_pool?rev=1226283142&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/overview_of_compiling_to_stack_machine?rev=1225577271&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/parse_trees_ambiguity_and_derivations?rev=1222202147&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/parsertrees.scala?rev=1223280326&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/parsingtechniques?rev=1223738747&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/phases_of_a_compiler?rev=1228589086&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/pointer_reversal?rev=1229295048&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/polynomials.pscala?rev=1222612001&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/polynomialsll.grammar?rev=1222599420&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/polytokens.jj?rev=1221153954&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/polytokentest.java?rev=1221154024&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/postfix_translation_of_boolean_operators?rev=1226275427&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/precedence_in_lr_parsing?rev=1223242302&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/prefix_infix_postfix_notation?rev=1225646798&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/printing_prefix_infix_postfix?rev=1225645454&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/programs.scala?rev=1222428130&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/proving_safety_properties_using_types?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/pushdown_automata?rev=1223132484&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/quiz?rev=1229338338&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/race?rev=1228315049&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/range_analysis?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/rangeanalysislattice.scala?rev=1227653712&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/recursive_descent_parsing?rev=1223128805&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/reference_counting?rev=1229290905&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/register_allocation_using_liveness_information?rev=1228736559&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/register_machine_in_scala?rev=1258932956&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/reporting_errors_based_on_syntax_tree?rev=1223876237&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/resolving_variable_names?rev=1223862847&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/scalabestpractice?rev=1227089061&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/semantic_analysis_as_simplified_interpretation?rev=1224249045&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/short-circuit_evaluation?rev=1226277494&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/sign_analysis?rev=1226886485&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/signanalysis.scala?rev=1258916813&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/simple_types_for_lambda_calculus?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/simpleast.scala?rev=1227491354&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/simplecfg.scala?rev=1227491333&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/simpletranslate.scala?rev=1227491380&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/simply_typed_lambda_calculus?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/slr_parser_actions?rev=1223239860&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/solution?rev=1223452364&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/squares.while?rev=1221171716&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/stack_frames_and_procedure_calls?rev=1228694501&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/subtyping_for_assignments?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/subtyping_for_functions?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/subtyping_rules?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/symbol_table_contents?rev=1223876515&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/termination_of_data-flow_analysis?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/test.jvm?rev=1220862454&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/test.s?rev=1220803439&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/testpolyinput.poly?rev=1221154097&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/tiger_book?rev=1220966083&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/tokens.scala?rev=1221220304&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/tokens_words_of_while_language?rev=1221224583&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/tools_for_constructing_lexers?rev=1221927116&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/top?rev=1230980085&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/transforming_to_chomsky_normal_form?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/translating_expressions_to_stack_machine?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/translating_expressions_to_stack_machine_code?rev=1225020176&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/translating_syntax_tree_to_cfg?rev=1226887933&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/translation_correctness_for_expressions?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/translation_of_relations?rev=1226272774&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/tree.scala?rev=1222428100&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/treesimplifier.scala?rev=1222428148&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/trivia_bad_languages?rev=1225054328&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/type_checking_let_and_letrec?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/type_soundness_for_simply_typed_lambda_calculus?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/types_and_programming_languages?rev=1224965800&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/types_and_programming_languages_book?rev=1223863491&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/typestate_analysis?rev=1227696318&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/typing_rules_for_simple_language?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/typos_in_compiler_construction_by_wirth?rev=1226072854&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/using_finite_state_machines_for_lexical_analysis?rev=1222201602&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/variable_capture?rev=1429630495&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/vm_for_expressions?rev=1225624714&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/week_02?rev=1221058034&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/what_is_a_compiler?rev=1220862861&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/while_language?rev=1222693420&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/whileparser.scala?rev=1223280304&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/why_study_compilers?rev=1220973123&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/why_study_lexical_analysis?rev=1221151310&amp;do=diff"/>
                <rdf:li rdf:resource="https://lara.epfl.ch/w/compilation/xyz_example_using_gcc?rev=1228701133&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://lara.epfl.ch/w/lib/tpl/epflv2/images/favicon.ico">
        <title>LARA: Laboratory for Automated Reasoning and Analysis</title>
        <link>https://lara.epfl.ch/w/</link>
        <url>https://lara.epfl.ch/w/lib/tpl/epflv2/images/favicon.ico</url>
    </image>
    <item rdf:about="https://lara.epfl.ch/w/compilation/abstract_syntax_of_while?rev=1221432355&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-15T00:45:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:abstract_syntax_of_while</title>
        <link>https://lara.epfl.ch/w/compilation/abstract_syntax_of_while?rev=1221432355&amp;do=diff</link>
        <description>Abstract Syntax for While

Abstract Syntax = concise representation of program as a data structure

	*  ignores concrete symbols (whether we use “{” or “begin” for blocks)
	*  maps easily to Scala's case classes

For our While language:
program ::= statement
statement ::= print | read | assign | if | while | block
print ::= string var
assign ::= var expr
if ::= exp statement (statement)?
while ::= expr statement
block ::= statement*
expr ::= var | literal | expr binOp expr | unOp expr</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/accessing_and_storing_variables?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:accessing_and_storing_variables</title>
        <link>https://lara.epfl.ch/w/compilation/accessing_and_storing_variables?rev=1429630495&amp;do=diff</link>
        <description>Accessing and Storing Variables

Local Variables

Instructions to load and store local variables:

	*  iload
	*  istore

Assigning indices (called slots) to local variables:

	*  in which compiler phase?
	*  how?

Function 

	*  maps variable ocurrence, not name (part of symbol table)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/ahoullman?rev=1255269393&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-10-11T15:56:33+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:ahoullman</title>
        <link>https://lara.epfl.ch/w/compilation/ahoullman?rev=1255269393&amp;do=diff</link>
        <description>The theory of parsing, translation, and compiling

This excellent advanced textbook is available online from ACM

	*  &lt;http://portal.acm.org/citation.cfm?id=SERIES11430.578789&gt;

under “ACM Classic Books Series”


@book{578789,
 author = {Alfred V. Aho and Jeffrey D. Ullman},
 title = {The theory of parsing, translation, and compiling},
 year = {1972},
 isbn = {0-13-914556-7},
 publisher = {Prentice-Hall, Inc.},
 address = {Upper Saddle River, NJ, USA},
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/algorithm_for_first_and_follow_sets?rev=1223123415&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-04T14:30:15+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:algorithm_for_first_and_follow_sets</title>
        <link>https://lara.epfl.ch/w/compilation/algorithm_for_first_and_follow_sets?rev=1223123415&amp;do=diff</link>
        <description>Algorithm for Computing First and Follow Sets

Building on Recursive Descent Parsing


nullable = {}
foreach nonterminal X:
  first(X)={}
  follow(X)={}
for each terminal Y:
  first(Y)={Y}

repeat
  foreach grammar rule X ::= Y(1) ... Y(k)
  if k=0 or {Y(1),...,Y(k)} subset of nullable then
    nullable = nullable union {X}
  for i = 1 to k
    for j = i+1 to k
      if i=1 or {Y(1),...,Y(i-1)} subset of nullable then
        first(X) = first(X) union first(Y(i))
      if i=k or {Y(i+1),...Y(k)}…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/alternatives_to_compilation?rev=1220864856&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-08T11:07:36+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:alternatives_to_compilation</title>
        <link>https://lara.epfl.ch/w/compilation/alternatives_to_compilation?rev=1220864856&amp;do=diff</link>
        <description>Alternatives to compilation?

Interpreter is a program that reads source code and directly executes it

	*  does not generate the translation of the source program first

Advantages of compilers over interpreters:

	*  once compiled, execution can be much faster</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/an_efficient_functional_map?rev=1223858806&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T02:46:46+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:an_efficient_functional_map</title>
        <link>https://lara.epfl.ch/w/compilation/an_efficient_functional_map?rev=1223858806&amp;do=diff</link>
        <description>An Efficient Functional Map

Balanced Binary Search Trees

	*  update creates a new path (copying only log(n) nodes)
	*  lookup and update in log(n)
	*  worst-case guaranteed by balancing
	*  rebalancing can also be done functionally on update

Alternative:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/an_efficient_imperative_map?rev=1223858901&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T02:48:21+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:an_efficient_imperative_map</title>
        <link>https://lara.epfl.ch/w/compilation/an_efficient_imperative_map?rev=1223858901&amp;do=diff</link>
        <description>An Efficient Imperative Map

Hashtable

	*  compute hash of keys, determiines the bucket
	*  storing key-value pairs in buckets
		*  buckets as linked lists, or
		*  buckets within the array, with a probing function that fills array

	*  for constant time we have large enough array, collisions rare</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/applications_of_data-flow_analysis?rev=1227622345&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T15:12:25+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:applications_of_data-flow_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/applications_of_data-flow_analysis?rev=1227622345&amp;do=diff</link>
        <description>Applications of Data-Flow Analysis

	*  optimization
	*  correctness

Optimization

Brief list of data-flow analyses and their uses - from Tiger book, sav08, papers

Checks:

	*  initialization analysis
	*  protocol usage analysis
	*  array bounds checks</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/arm_architecture?rev=1228664137&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-07T16:35:37+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:arm_architecture</title>
        <link>https://lara.epfl.ch/w/compilation/arm_architecture?rev=1228664137&amp;do=diff</link>
        <description>ARM Architecture

A family of CPUs

From article on RISC architectures:

“The ARM architecture dominates the market for high performance, low power, low cost embedded systems (typically 100–500 MHz in 2008). ARM Ltd., which licenses intellectual property rather than manufacturing chips, reported 10 billion licensed chips shipped in early 2008 [7]. ARM is deployed in countless mobile devices such as:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/array_manipulation?rev=1225675870&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T02:31:10+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:array_manipulation</title>
        <link>https://lara.epfl.ch/w/compilation/array_manipulation?rev=1225675870&amp;do=diff</link>
        <description>Array Manipulation

newarray

anewarray

iaload

iastore

arraylength</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/automata_for_lr_parsing_without_lookahead?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:automata_for_lr_parsing_without_lookahead</title>
        <link>https://lara.epfl.ch/w/compilation/automata_for_lr_parsing_without_lookahead?rev=1429630495&amp;do=diff</link>
        <description>Automata for LR Parsing without Lookahead

These automata are used to construct LR(0) and SLR parsers

We describe their states and transitions

LR(0) item is a dotted production 

	*   is grammar rule 
	*   some strings of terminals and non-terminals</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/booleans_and_data_representation?rev=1226259463&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-09T20:37:43+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:booleans_and_data_representation</title>
        <link>https://lara.epfl.ch/w/compilation/booleans_and_data_representation?rev=1226259463&amp;do=diff</link>
        <description>Booleans and Data Representation

Types in programming language:

	*  specify length of data (how many bits)
	*  help prevent errors
	*  enforce program invariants

In assembly and C:

	*  possible to case integer into a pointer
	*  enables program to write to random memory locations</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/bottop-up_type_checking?rev=1224245578&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-17T14:12:58+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:bottop-up_type_checking</title>
        <link>https://lara.epfl.ch/w/compilation/bottop-up_type_checking?rev=1224245578&amp;do=diff</link>
        <description>Bottop-Up Type Checking

Recall function interpExpr function in

	*  Handling Scopes in Interpreters
	*  Semantic Analysis as Simplified Interpretation

Forget about uninitialized values for now, worry only about types

We evaluate type analogously to evaluating expressions

Principles:

	*  all variables are declared with their types</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/branching_jvm_instructions?rev=1226307790&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T10:03:10+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:branching_jvm_instructions</title>
        <link>https://lara.epfl.ch/w/compilation/branching_jvm_instructions?rev=1226307790&amp;do=diff</link>
        <description>JVM Instructions for Branching

See table of JVM instructions

Unconditional jumps: goto

Conditional branch on comparison to zero:

	*  if_&lt;cond&gt;
	*  by convention on booleans in Booleans and Data Representation, we can use if_eq to mean ifFalse
	*  can use if_ne to mean ifTrue (because 1 is not equal to 0)

There are also conditional branches for comparison of two operands:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/building_a_pretty_printer?rev=1223280389&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-06T10:06:29+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:building_a_pretty_printer</title>
        <link>https://lara.epfl.ch/w/compilation/building_a_pretty_printer?rev=1223280389&amp;do=diff</link>
        <description>Building a Pretty Printer

A pretty printer:

	*  parses input source
	*  prints it, perhaps with improved formatting
		*  e.g. HTML listing, documentation, latex


Simple pretty printer is in tree.scala

Operations:
lex   : List[Char] -&gt; List[Token] 
parse : List[Token] -&gt; Tree
print : Tree -&gt; List[Char]</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/building_ll_parsing_table?rev=1223279555&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-06T09:52:35+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:building_ll_parsing_table</title>
        <link>https://lara.epfl.ch/w/compilation/building_ll_parsing_table?rev=1223279555&amp;do=diff</link>
        <description>Building LL Parsing Table

Continuing summary of Recursive Descent Parsing

Parsing table for LL parser is of form
choice : Nonterminal -&gt; Token -&gt; Set[Int]
We computing it for each nonterminal X by looking at all right-hand sides of X. Denote i-th right-hand side of X by p(X,i):</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/cafebabe-abc?rev=1321881443&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-11-21T14:17:23+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:cafebabe-abc</title>
        <link>https://lara.epfl.ch/w/compilation/cafebabe-abc?rev=1321881443&amp;do=diff</link>
        <description>The Cafebabe Bytecode Generation Library

IMPORTANT: This page is now outdated. Cafebabe has moved to GitHub and so has the documentation.

The main Cafebabe page is here.

Full examples are available here.

Abstract Byte Codes

Loading constant values

Constant values can be pushed on the stack in several different ways. Integers in particular can be pushed using the various</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/cafebabe-examples?rev=1321881454&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-11-21T14:17:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:cafebabe-examples</title>
        <link>https://lara.epfl.ch/w/compilation/cafebabe-examples?rev=1321881454&amp;do=diff</link>
        <description>The Cafebabe Bytecode Generation Library: Examples

IMPORTANT: This page is now outdated. Cafebabe has moved to GitHub and so has the documentation.

See also:

	*  Cafebabe introduction page
	*  Abstract Bytecodes

Hello world

The good old:


class HW {
  public static void main(String [] args) {
    System.out.println(&quot;Hello world!&quot;);
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/cafebabe?rev=1321881431&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-11-21T14:17:11+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:cafebabe</title>
        <link>https://lara.epfl.ch/w/compilation/cafebabe?rev=1321881431&amp;do=diff</link>
        <description>The Scala Cafebabe Bytecode Generation Library

IMPORTANT: This page is now outdated. Cafebabe has moved to GitHub and so has the documentation.

Introduction

This page is an introduction to the byte code generation library “Cafebabe”. Rather than exposing an API-like reference, we present the capabilities of the library through examples.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/charstream.scala?rev=1221061003&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-10T17:36:43+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:charstream.scala</title>
        <link>https://lara.epfl.ch/w/compilation/charstream.scala?rev=1221061003&amp;do=diff</link>
        <description>import java.io._
class EndOfInput(stream : String) extends Exception
class CharStream(fileName : String) {
  val file = new BufferedReader(new FileReader(fileName))
  var current : Char = ' '
  var eof : Boolean = false

  def next = {
    if (eof) throw new EndOfInput(&quot;reading&quot; + file)
    val c = file.read()
    eof = (c == -1)
    current = c.asInstanceOf[Char]
  }

  next
}

object Test {
  // test for using CharStream
  def main(args : Array[String]) = {
    val s = new CharStream(args(0))
…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/collatz.while?rev=1221172494&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-12T00:34:54+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:collatz.while</title>
        <link>https://lara.epfl.ch/w/compilation/collatz.while?rev=1221172494&amp;do=diff</link>
        <description>x = 13;
while (x &gt; 1) {
  println(&quot;x=&quot;, x);
  if (x % 2 == 0) {
    x = x / 2;
  } else {
    x = 3 * x + 1;
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compilation_as_tree_transformation?rev=1226281396&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T02:43:16+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compilation_as_tree_transformation</title>
        <link>https://lara.epfl.ch/w/compilation/compilation_as_tree_transformation?rev=1226281396&amp;do=diff</link>
        <description>Compilation as Tree Transformation

To describe this compilation we introduce an imaginary, big, instruction
branch(c,nThen,nElse)
Here

	*  c is a potentially complex Java boolean expression
	*  nThen is label to jump to when c evaluates to true
	*</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiled_counting_examples?rev=1225580466&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-02T00:01:06+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiled_counting_examples</title>
        <link>https://lara.epfl.ch/w/compilation/compiled_counting_examples?rev=1225580466&amp;do=diff</link>
        <description>Compiled Counting Examples

Simple Counting


class CountingSimple {
    public static void count(int from, int to, int step) {
	int counter = from;
	while (counter &lt; to) {
	    counter = counter + step;
	}
    }
}


Bytecode:


public static void count(int, int, int);
  Code:
   0:   iload_0
   1:   istore_3
   2:   iload_3
   3:   iload_1
   4:   if_icmpge       14
   7:   iload_3
   8:   iload_2
   9:   iadd
   10:  istore_3
   11:  goto    2
   14:  return

  LineNumberTable: 
   line 3: 0
 …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiled_expression_examples?rev=1225579524&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-01T23:45:24+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiled_expression_examples</title>
        <link>https://lara.epfl.ch/w/compilation/compiled_expression_examples?rev=1225579524&amp;do=diff</link>
        <description>Compiled Expression Examples

Twice

Java:


class Expr1 {
    public static int twice(int x) {
	return x*2;
    }
}


Bytecode:
javac -g Expr1.java
javap -c -l Expr1

public static int twice(int);
  Code:
   0:   iload_0    // load int from var 0 to top of stack
   1:   iconst_2   // push 2 on top of stack
   2:   imul       // replace two topmost elements with their product
   3:   ireturn    // return top of stack
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiled_factorial_example?rev=1225564145&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-01T19:29:05+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiled_factorial_example</title>
        <link>https://lara.epfl.ch/w/compilation/compiled_factorial_example?rev=1225564145&amp;do=diff</link>
        <description>Compiled Factorial Example

Factorial example:


class Factorial {
    public int fact(int num){
	int num_aux;
	if (num &lt; 1)
	    num_aux = 1 ;
	else 
	    num_aux = num * (this.fact(num-1));
	return num_aux;
    }
}


Result of compilation with javac:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiler_construction_by_niklaus_wirth?rev=1226072752&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-07T16:45:52+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiler_construction_by_niklaus_wirth</title>
        <link>https://lara.epfl.ch/w/compilation/compiler_construction_by_niklaus_wirth?rev=1226072752&amp;do=diff</link>
        <description>Compiler Construction by Niklaus Wirth

You can download here the textbook [Compiler Construction, by Niklaus Wirth].

Click here for Book Web Site

A few Typos in Compiler Construction by Wirth</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiler_construction_tools?rev=1220968138&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-09T15:48:58+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiler_construction_tools</title>
        <link>https://lara.epfl.ch/w/compilation/compiler_construction_tools?rev=1220968138&amp;do=diff</link>
        <description>Compiler Construction Tools

JavaCC 

SableCC

JLex + JCUP

Coco/R

Antlr

Combinator Parsers</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiler_interface_to_garbage_collector?rev=1229301688&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-15T01:41:28+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiler_interface_to_garbage_collector</title>
        <link>https://lara.epfl.ch/w/compilation/compiler_interface_to_garbage_collector?rev=1229301688&amp;do=diff</link>
        <description>Compiler Interface to Garbage Collector

Garbage collector needs to know

	*  reference roots
	*  reference fields

Need to generation information on

	*  global variables 
	*  heap: tag each record with its type information, like class descriptors for dynamic method calls from</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compilers_in_action?rev=1225543793&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-01T13:49:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compilers_in_action</title>
        <link>https://lara.epfl.ch/w/compilation/compilers_in_action?rev=1225543793&amp;do=diff</link>
        <description>Compilers in Action

gcc Compilers for C

Example program in C programming language


#include &lt;stdio.h&gt;

int main(void) {
  int i = 0;
  int j = 0;
  while (i &lt; 10) {
    printf(&quot;%d\n&quot;, j);
    i = i + 1;
    j = j + 2*i+1;
  }
}


We will pay attention to line:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiling_conditional_expressions?rev=1227079652&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-19T08:27:32+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiling_conditional_expressions</title>
        <link>https://lara.epfl.ch/w/compilation/compiling_conditional_expressions?rev=1227079652&amp;do=diff</link>
        <description>Compiling Conditional Expressions

Expression (c ? t : e) evaluates to

	*  t, if c is true
	*  e, if c is false


[[ c ? t : e ]] =
        [[ c ]] 
        ifeq nElse
        [[ t ]]
        goto nAfter
nElse:  [[ e ]]
nAfter: 


This is like Compiling If Then Else

	*</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiling_if_then_else?rev=1226264230&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-09T21:57:10+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiling_if_then_else</title>
        <link>https://lara.epfl.ch/w/compilation/compiling_if_then_else?rev=1226264230&amp;do=diff</link>
        <description>Compiling If-Then-Else

Compiled Factorial Example

Assume that translation of c, denoted [ [ c ] ], produces a boolean value on top of the stack

Then:


[[ If (c) sThen else sElse ]] =
       [[ c ]]
       if_eq nAfter
       [[ sThen ]]
       goto nAfter
nElse: [[ s2 ]]
nAfter:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiling_statement_sequence?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiling_statement_sequence</title>
        <link>https://lara.epfl.ch/w/compilation/compiling_statement_sequence?rev=1429630495&amp;do=diff</link>
        <description>Compiling Statement Sequence



 [\![s_1 ; \ldots; s_n ]\!] = [\![s_1]\!] ::: \ldots ::: [\![s_n]\!]</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/compiling_while?rev=1226266493&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-09T22:34:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:compiling_while</title>
        <link>https://lara.epfl.ch/w/compilation/compiling_while?rev=1226266493&amp;do=diff</link>
        <description>Compiling While


[[ while(c) s ]] =
nStart: [[c]]
        if_eq nAfter
        [[s]]
        goto nStart
nAfter:


Example

Java code:


class Test {
    static boolean condition(int n) { ... }
    static void work(int n) { ... }
    static void test() {
	int n = 100;
	while (condition(n)) {
	    n = n - 11;
	    work(n);
	}
    }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/computing_labels?rev=1226263834&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-09T21:50:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:computing_labels</title>
        <link>https://lara.epfl.ch/w/compilation/computing_labels?rev=1226263834&amp;do=diff</link>
        <description>Computing Labels

Labels are symbolic names for targets of branch instructions

Two-Pass Approach

	*  generate sequence of instructions with unknown destinations
	*  once lengths of code are known, resolve all labels
	*  emit the code

Two main kinds of jumps:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/concrete_execution_as_data-flow_analysis?rev=1227628831&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T17:00:31+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:concrete_execution_as_data-flow_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/concrete_execution_as_data-flow_analysis?rev=1227628831&amp;do=diff</link>
        <description>Concrete Execution as Data-Flow Analysis

For a large class of properties, the most precise data-flow analysis is program execution itself

	*  an element is a set of states (not just one state)
	*  bottom: empty set
	*  top: all states

If program execution terminates, so does this analysis</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/concrete_syntax_of_while?rev=1222695924&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-29T15:45:24+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:concrete_syntax_of_while</title>
        <link>https://lara.epfl.ch/w/compilation/concrete_syntax_of_while?rev=1222695924&amp;do=diff</link>
        <description>Concrete Syntax of While Language
program ::= statement*
statement ::= print | assign | if | while | block
print ::= &quot;println&quot; &quot;(&quot; STRLIT &quot;,&quot; var &quot;)&quot; &quot;;&quot;
assign ::= var &quot;=&quot; expr &quot;;&quot;
if ::= &quot;if&quot; &quot;(&quot; exp &quot;)&quot; statement (&quot;else&quot; statement)?
while ::= &quot;while&quot; &quot;(&quot; expr &quot;)&quot; statement
block ::= &quot;{&quot; statement* &quot;}&quot;
expr ::= var | INTLIT | expr binOp expr | unOp expr | &quot;(&quot; expr &quot;)&quot;
unOp ::= &quot;!&quot; | &quot;-&quot;
binOp ::= &quot;+&quot; | &quot;-&quot; | &quot;*&quot; | &quot;/&quot; | &quot;%&quot; | &quot;==&quot; | &quot;&gt;&quot; | &quot;&lt;&quot; | &quot;&amp;&amp;&quot; | &quot;||&quot;</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/concreteanalysis.scala?rev=1227491478&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-24T02:51:18+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:concreteanalysis.scala</title>
        <link>https://lara.epfl.ch/w/compilation/concreteanalysis.scala?rev=1227491478&amp;do=diff</link>
        <description>// Lattice of concrete executions of integer programs
object ConcreteLattice extends Lattice {
  type State = Map[String,Int] // specific to this particular example
  type Elem = Set[State]
  def leq(x : Elem, y : Elem) : Boolean = x.subsetOf(y)
  val bottom = Set[State]()
  lazy val top = error(&quot;lattice element too big to compute&quot;)
  def join(x : Elem, y : Elem) = (x ++ y) // union
  def meet(x : Elem, y : Elem) = (x ** y) // intersection
}

import SimpleCFG._
object ConcreteTransFun extends 
 …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/constant_propagation?rev=1226886205&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-17T02:43:25+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:constant_propagation</title>
        <link>https://lara.epfl.ch/w/compilation/constant_propagation?rev=1226886205&amp;do=diff</link>
        <description>Constant Propagation

	*  like initialization, but keeps the value to which it is initialized
\bot, C, potentially non-constantint a, b, step, i;
boolean c;
a = 0;
b = a + 10;
step = -1;
if (step &gt; 0) {
  i = a;
} else {
  i = b;
}
c = true;
while (c) {
  print(i);
  i = i + step;    // can emit decrement
  if (step &gt; 0) {
    c = (i &lt; b);
  } else {
    c = (i &gt; a); // can emit better instruction here
    // put here (a = a + step), redo analysis
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/constraint-based_type_checking?rev=1225272557&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-29T10:29:17+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:constraint-based_type_checking</title>
        <link>https://lara.epfl.ch/w/compilation/constraint-based_type_checking?rev=1225272557&amp;do=diff</link>
        <description>Constraint-Based Type Checking and Inference

Motivation for Type Inference

Example:


 % y:int. let ((f:int-&gt;int) = % x:int. x+3) in f (f (y+5))


Bottom-up type checking concludes:


y:int
5:int
y+5:int
x:int
3:int
x+3:int
(% x:int. x+3): int-&gt;int
f:int-&gt;int
f(y+5):int
f(f (y+5)):int
(% y:int. let ((f:int-&gt;int) = ...) : int-&gt;int</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/control-flow_graph_definition?rev=1227087842&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-19T10:44:02+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:control-flow_graph_definition</title>
        <link>https://lara.epfl.ch/w/compilation/control-flow_graph_definition?rev=1227087842&amp;do=diff</link>
        <description>Control-Flow Graph Definition

Recall Linearizing Trees with Control-Flow, Different Views of IfThenElse

	*  control-flow graphs are the graph view

Like automaton but with variables

Related to traditional notion of flow charts

Definition: Control-Flow Graph (CFG) is graph  where</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/control-flow_graph_to_assembly_with_global_variables?rev=1228684180&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-07T22:09:40+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:control-flow_graph_to_assembly_with_global_variables</title>
        <link>https://lara.epfl.ch/w/compilation/control-flow_graph_to_assembly_with_global_variables?rev=1228684180&amp;do=diff</link>
        <description>Control-Flow Graph to Assembly with Global Variables

Recall SimpleCFG.scala from Lecture 11

How to compile e.g. a quadruple?
x = y * z
One possibility: translate each quadruple independently into machine instruction sequence such as
Move(Register(r1), Memory(yAddr))
Move(Register(r2), Memory(zAddr))
Quad(Register(r1), Register(r1), Register(r2))
Move(Memory(xAddr), Register(r1))</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/copying_garbage_collector?rev=1229297118&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-15T00:25:18+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:copying_garbage_collector</title>
        <link>https://lara.epfl.ch/w/compilation/copying_garbage_collector?rev=1229297118&amp;do=diff</link>
        <description>Copying Garbage Collector

Some advantages compared to mark-and-sweep:

	*  no fragmentation
	*  fast allocation, as in MallocInfMem.scala
	*  good when a lot of data allocated and thrown away (as in functional languages)

Disadvantage: double space consumption

	*  note that fragmentation can (very infriquently) mean inability to allocate block even if there is e.g. 1000 more space</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/course_information?rev=1225557041&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-01T17:30:41+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:course_information</title>
        <link>https://lara.epfl.ch/w/compilation/course_information?rev=1225557041&amp;do=diff</link>
        <description>Course Information for Compiler Construction (CS-320)

Staff

Lectures:

	*  Viktor Kuncak

Practical and Theoretical Exercises:

	*  Ruzica Piskac
	*  Philippe Suter

Assistants-Étudiants

	*  Sebastian Gfeller
	*  Cédric Lavanchy
	*  Ersoy Bayramoglu

Secretary: Danielle Chamberlain

Schedule

	*  Mondays 10:15-12:00 - Lectures in</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/cyk_parsing_algorithm?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:cyk_parsing_algorithm</title>
        <link>https://lara.epfl.ch/w/compilation/cyk_parsing_algorithm?rev=1429630495&amp;do=diff</link>
        <description>CYK Parsing Algorithm for General Context-Free Grammars

Given a context-free grammar , how to check if ?

	*  recursive descent gives efficient answer when  is LL(1)
	*  we now see how to do it for arbitrary context-free grammar 

Conventions:

	*  S will always denote the start symbol of the grammar</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/dataflowanalysis.scala?rev=1258916043&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-11-22T19:54:03+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:dataflowanalysis.scala</title>
        <link>https://lara.epfl.ch/w/compilation/dataflowanalysis.scala?rev=1258916043&amp;do=diff</link>
        <description>// specialized to SimpleCFG
import SimpleCFG._
abstract class TransferFunction[L, CFGStatement] { 
  // L is information propagate through CFG nodes
  def apply(node : CFGStatement, x : L) : L
  // if x describes a set of states,
  // then apply(n,x) describes states obtained from x by executing statement n
}

class AnalysisAlgoritm[L,CFGStatement]
               (transferFun : TransferFunction[L, CFGStatement],
		lattice : Lattice{type Elem=L},
		cfg : LabDiGraphImp[CFGStatement])
{
  type Vert…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/designing_correct_data-flow_analyses?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:designing_correct_data-flow_analyses</title>
        <link>https://lara.epfl.ch/w/compilation/designing_correct_data-flow_analyses?rev=1429630495&amp;do=diff</link>
        <description>Designing Correct Data-Flow Analyses

Define Properties of Interest

Define precisely what property is needed (depends on the application), e.g.

	*  absence of errors
	*  potentially improving code performance without changing program meaning

Example: every variable assigned before being read</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/digraphs.scala?rev=1227491299&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-24T02:48:19+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:digraphs.scala</title>
        <link>https://lara.epfl.ch/w/compilation/digraphs.scala?rev=1227491299&amp;do=diff</link>
        <description>/* Mutable Directed Graph with Labels */
abstract trait LabDiGraph[Label] {
  type Vertex
  type Edge
  def V : Set[Vertex]
  def E : Set[Edge]
  def newVertex : Vertex
  def += (from : Vertex, lab : Label, to : Vertex)
  def inEdges(v : Vertex)  : Set[Edge]
  def outEdges(v : Vertex) : Set[Edge]
  def -= (from : Vertex, lab : Label, to : Vertex)
  def labelMap[NewLabel](f : Label =&gt; NewLabel) : LabDiGraph[NewLabel]
}


case class LVertex[L](name : String) {
  var in  : Set[LEdge[L]] = Set[LEdge…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/earley_parser?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:earley_parser</title>
        <link>https://lara.epfl.ch/w/compilation/earley_parser?rev=1429630495&amp;do=diff</link>
        <description>Earley Parser

What is Earley Parser

A parser for context-free grammars

	*  works for arbitrary, even ambiguous, grammars
	*  runs in O(n^3) in general
	*  unlike CYK Parsing Algorithm, it does not require Transforming to Chomsky Normal Form
	*  for unambiguous grammars it runs in O(n^2)
	*  for grammars handled by LR parsers, it runs in O(n)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/efficient_comparison_for_identifiers?rev=1223876917&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T07:48:37+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:efficient_comparison_for_identifiers</title>
        <link>https://lara.epfl.ch/w/compilation/efficient_comparison_for_identifiers?rev=1223876917&amp;do=diff</link>
        <description>Efficient Comparison for Identifiers

Identifiers can be very long

Comparing them directly is inefficient

Lexical analyzer can immediately replace them with references to symbol objects

	*  hash table stores mapping of strings to symbols
	*  pointers equal iff strings equal</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/efficiently_emitting_code?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:efficiently_emitting_code</title>
        <link>https://lara.epfl.ch/w/compilation/efficiently_emitting_code?rev=1429630495&amp;do=diff</link>
        <description>Efficiently Emitting Code

Efficiency Problem

Consider concatenation-based implementation



Consider standard purely functional list implementation
EmptyList ::: ys = ys
(x::xs)   ::: ys = x::(xs ::: ys)
How many times is  traversed in such implementation?</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/elanguage?rev=1228919509&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-10T15:31:49+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:elanguage</title>
        <link>https://lara.epfl.ch/w/compilation/elanguage?rev=1228919509&amp;do=diff</link>
        <description>ELanguage


start ::= e
e ::= e &quot;+&quot; e | e &quot;*&quot; e | e &quot;/&quot; e | block | &quot;(&quot; e &quot;)&quot; | e &quot;(&quot; e* &quot;)&quot;
    | e &quot;||&quot; e | e &quot;&lt;&quot; e
    | ident | intLiteral | floatLiteral

valdef ::= fdef | &quot;val&quot; ident &quot;:&quot; type &quot;=&quot; e
fdef ::= &quot;def&quot; ident &quot;(&quot; typedIdList &quot;)&quot; &quot;:&quot; type &quot;=&quot; e

block ::= &quot;{&quot; valdef* e &quot;}&quot;

ident ::= letter (letter | diggit)*
intLiteral ::= nonZerodigit digit*
             | &quot;0&quot;
             | &quot;0&quot; &quot;x&quot; hexDigit+
             | &quot;0&quot; digit*
floatLiteral ::= intLiteral &quot;.&quot; digit*
type ::= &quot;int&quot; | &quot;floa…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/evaluating_postfix?rev=1225651343&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-02T19:42:23+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:evaluating_postfix</title>
        <link>https://lara.epfl.ch/w/compilation/evaluating_postfix?rev=1225651343&amp;do=diff</link>
        <description>Evaluating Postfix and its Correctness


sealed abstract class Expr
case class Var(varID: String) extends Expr
case class IntLiteral(value: Int) extends Expr
case class Plus(lhs: Expr, rhs: Expr) extends Expr
case class Times(lhs: Expr, rhs: Expr) extends Expr

sealed abstract class Token
case class ID(str : String) extends Token
case class Const(c : Int) extends Token
case class Add extends Token
case class Mul extends Token

object Print {
  def postfix(e : Expr) : List[Token] = e match {
    …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/ex3-javacc-stub?rev=1222872752&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-01T16:52:32+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:ex3-javacc-stub</title>
        <link>https://lara.epfl.ch/w/compilation/ex3-javacc-stub?rev=1222872752&amp;do=diff</link>
        <description>options {
    STATIC = false;
}

PARSER_BEGIN(WhileParser)
    class WhileParser {
        public static void main(String[] args) throws ParseException, TokenMgrError {
            WhileParser parser = new WhileParser(System.in);
            parser.Start();
        }
    }
PARSER_END(WhileParser)

SKIP : { &quot; &quot; | &quot;\t&quot; | &quot;\n&quot; | &quot;\r&quot; | &lt; &quot;//&quot;(~[&quot;\n&quot;, &quot;\r&quot;])* (&quot;\n&quot; | &quot;\r&quot; | &quot;\r\n&quot;)&gt; }
TOKEN : { &lt; INTLIT: &quot;0&quot; | [&quot;1&quot;-&quot;9&quot;]([&quot;0&quot;-&quot;9&quot;])* &gt; }
TOKEN : { &lt; STRLIT: &quot;\&quot;&quot; (~[&quot;\&quot;&quot;, &quot;\n&quot;, &quot;\r&quot;])* &quot;\&quot;&quot; &gt; }TOKEN : …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/example_efficient_code_for_conditionals?rev=1226279353&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T02:09:13+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:example_efficient_code_for_conditionals</title>
        <link>https://lara.epfl.ch/w/compilation/example_efficient_code_for_conditionals?rev=1226279353&amp;do=diff</link>
        <description>Example Efficient Code for Conditionals


class Activity {
    static int activityLevel = 0;

    static boolean action(int signals, boolean objects, int smart, int pretty) {
	if (smart + 2*pretty &gt; 10 &amp;&amp; !(signals &lt;= 5 &amp;&amp; objects)) {
	    activityLevel++;
	    return true;
	} else {
	    return false;
	}
    }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/example_ocamlyacc_grammar?rev=1223237686&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T22:14:46+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:example_ocamlyacc_grammar</title>
        <link>https://lara.epfl.ch/w/compilation/example_ocamlyacc_grammar?rev=1223237686&amp;do=diff</link>
        <description>Example Ocamlyacc Grammar

The Objective Caml programming language comes with ocamlyacc LALR(1) parser generator

	*  documented in language manual
	*  separate tutorial

Here is a Java 1.2 parser written in OcamlYacc and used in Jahob Program Verification System:

	*  jahobparser.yy</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/examples_of_compiled_java?rev=1225579969&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-01T23:52:49+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:examples_of_compiled_java</title>
        <link>https://lara.epfl.ch/w/compilation/examples_of_compiled_java?rev=1225579969&amp;do=diff</link>
        <description>Examples of Compiled Java

Compiled Expression Examples

Compiled Counting Examples

Compiled Factorial Example</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_01?rev=1221642973&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-17T11:16:13+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_01</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_01?rev=1221642973&amp;do=diff</link>
        <description>Exercises 01

Review: State Machines from Regular Expressions

Finite state machine

Determinization of finite state machine

Finite state machine with epsilon transitions

Closure properties of finite state machines

Floating point literals

Floating point constants can take many forms: they are signed, may have a fractional part and may have an additional (positive or negative) integer exponent to represent an attached power of 10. Examples of such literals are: 3.1415, -7, 6.02214e23, 0.27183…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_02?rev=1222242422&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-24T09:47:02+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_02</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_02?rev=1222242422&amp;do=diff</link>
        <description>Exercises 02

There are no exercises this week, see Lecture 02 instead.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_03?rev=1222872786&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-01T16:53:06+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_03</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_03?rev=1222872786&amp;do=diff</link>
        <description>Exercises 03

Important update

There was a bug in the stub .jj file that caused the keywords if, while, etc. to be recognized as identifiers rather than the proper tokens. It is now fixed. Make sure you use the latest version (that is, you should have</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_04?rev=1223468292&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-08T14:18:12+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_04</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_04?rev=1223468292&amp;do=diff</link>
        <description>Exercises 04

Only one exercise this week, enjoy. Hand in your assignment at the latest on Wednesday, Oct. 15th, 8:15am (note time change: it is due before labs!). Late submissions will not be graded.

You can hand them in as you arrive to the lab session, or drop them off earlier at BC 363.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_05?rev=1224661015&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-22T09:36:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_05</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_05?rev=1224661015&amp;do=diff</link>
        <description>Exercises 05

Please hand in your exercises before Wednesday, Oct. 22nd, 8.15am.

Earley Parsing I

Consider the following grammar:

S' -&gt; S $

S -&gt; s 

S -&gt; { S2 }

S -&gt; i c S

S -&gt; i c S e S

S2 -&gt; S2 S | S

	*  Parse the following string:  “icicse{ss}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_06?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_06</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_06?rev=1429630495&amp;do=diff</link>
        <description>Exercises 06

Exercises Session 06

Type Checking Arrays

This exercise is designed to make you think about certain
aspects of Java's type system.

Please hand in your exercises before Wednesday, Oct. 29th, 8.15am.

A Program

The following Java program defines a Cell class, which
stores an integer that can only be set once, and defines its
subclass</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_07?rev=1225746061&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T22:01:01+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_07</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_07?rev=1225746061&amp;do=diff</link>
        <description>Exercises 07

Material Done During Exercise Session

Discussion of the homework assignment from Exercises 06 and summary of invariants in case of subtyping (following Proving Safety Properties using Types).

Constraint-Based Type Checking

Unification

Homework Assignment, due 05 November 2008 at 8:15am

Note: get started on this assignment early.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_08?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_08</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_08?rev=1429630495&amp;do=diff</link>
        <description>Exercises 08

Material Done During Exercise Session

Example of code generation


/** Computes the max of two integer values */
public int max(int i, int j) {
  int res;
  res = (i &gt; j ? i : j);
  return res;
}


Possible corresponding bytecode:
0: iload_1
1: iload_2
2: if_icmple 5
3: iload_1
4: goto 6
5: iload_2
6: istore_3
7: iload_3
8: ireturn</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_09?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_09</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_09?rev=1429630495&amp;do=diff</link>
        <description>Exercises 09

Material for Exercise Session

Translate manually into bytecodes using the techniques in Compilation as Tree Transformation


int activityLevel
boolean action(int signals, boolean objects, int smart, int pretty) {
  if ((signals &gt; 5 || !objects) &amp;&amp; smart + 2*pretty &gt; 10) {
    activityLevel++;
    return true;
  } else {
    activityLevel--;
    return false;
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/exercises_session_06?rev=1224675343&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-22T13:35:43+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:exercises_session_06</title>
        <link>https://lara.epfl.ch/w/compilation/exercises_session_06?rev=1224675343&amp;do=diff</link>
        <description>Exercise Session 06

This summarizes activities done in class on 22 October 2008.

Type checking and evaluation for simply typed lambda calculus

Solved exercises:

1) Prove that the following program is type correct:
class Max {
  int max (int x, int y) {
    int res;
    res = (x &gt; y) ? x : y;
    return res;
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/final_projects_and_reports?rev=1230981627&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-01-03T12:20:27+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:final_projects_and_reports</title>
        <link>https://lara.epfl.ch/w/compilation/final_projects_and_reports?rev=1230981627&amp;do=diff</link>
        <description>Final Projects and Reports

You will submit your compiler and report through Moodle, as for homeworks.

The report should have between 4 and 10 pages (depending on
your formatting). You can use any software to typeset it,
including Latex, OpenOffice, or a standard</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/free_lists_by_size?rev=1229287414&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-14T21:43:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:free_lists_by_size</title>
        <link>https://lara.epfl.ch/w/compilation/free_lists_by_size?rev=1229287414&amp;do=diff</link>
        <description>Free Lists by Size

Simplest solution

	*  one free list for all sizes
	*  each block stores its size

Problem: efficiency of finding appropriate block

Array of free lists:

	*  for (almost) each size 
	*  when allocating block of size B, search in free(B), or in free(i) for i &gt;= B</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/from_stack_to_register_machines?rev=1226073328&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-07T16:55:28+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:from_stack_to_register_machines</title>
        <link>https://lara.epfl.ch/w/compilation/from_stack_to_register_machines?rev=1226073328&amp;do=diff</link>
        <description>From Stack to Register Machines

What is a register machine?

If stack depth is less than the number of general purpose registers, treat registers as stack.

If SP is a stack pointer as maintained by the compiler, then we essentially emit instructions that correspond to code for</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/functional_versus_imperative_maps?rev=1223855697&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T01:54:57+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:functional_versus_imperative_maps</title>
        <link>https://lara.epfl.ch/w/compilation/functional_versus_imperative_maps?rev=1223855697&amp;do=diff</link>
        <description>Functional versus Imperative Maps

Goal is to map identifiers to definitions

We need efficient operations on maps

	*  look up identifier to obtain its definition
	*  update map to store declarations
	*  revert declarations

Functional style

	*  seen in</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/generational_garbage_collectors?rev=1229298638&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-15T00:50:38+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:generational_garbage_collectors</title>
        <link>https://lara.epfl.ch/w/compilation/generational_garbage_collectors?rev=1229298638&amp;do=diff</link>
        <description>Generational Garbage Collectors

Divide heap into generations, typically according to age of objects

	*  how long ago was allocated

When the object is collected 2-3 times, promote it from younger to older generation

Newer generation about 1/2 size of old one</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/hand-written_scanner_for_while_language?rev=1221466163&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-15T10:09:23+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:hand-written_scanner_for_while_language</title>
        <link>https://lara.epfl.ch/w/compilation/hand-written_scanner_for_while_language?rev=1221466163&amp;do=diff</link>
        <description>Hand-Written Lexical Analyzer for While

Lexical Analyzer

Also called: lexer, scanner, or tokenizer

Transforms 
 sequence of characters 
into
 sequence of tokens 
Interfaces for Lexer

In practice, we read characters and generate tokens on demand

Work with</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/handling_scopes_in_interpreters?rev=1223894103&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T12:35:03+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:handling_scopes_in_interpreters</title>
        <link>https://lara.epfl.ch/w/compilation/handling_scopes_in_interpreters?rev=1223894103&amp;do=diff</link>
        <description>Handling Scopes in Interpreters

An Example interpreter for language with procedures and blocks


object ScopeInterpreter {
  type Ident = String

  case class Program(classes : List[ClassDef], classToRun : Ident)

  case class ClassDef(name : Ident, decls : List[ClassDecl])
  
  sealed abstract class Typ
  case object IntType extends Typ
  case object BoolType extends Typ
  case object VoidType extends Typ
  
  case class VarDecl(name : Ident, tp : Typ)
  
  sealed abstract class ClassDecl
  ca…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/higher-order_functions?rev=1228677784&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-07T20:23:04+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:higher-order_functions</title>
        <link>https://lara.epfl.ch/w/compilation/higher-order_functions?rev=1228677784&amp;do=diff</link>
        <description>Higher-Order Functions

Example of Code Compiled from Scala</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/idea_of_data_flow_analysis?rev=1227087782&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-19T10:43:02+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:idea_of_data_flow_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/idea_of_data_flow_analysis?rev=1227087782&amp;do=diff</link>
        <description>Idea of Data Flow Analysis

Goal Today

Introduce the ide of data-flow analysis

	*  a form of semantic analysis 

Why it is useful

Automatically derive information about the program

Use this information for:

	*  correctness checks (initialization, correct order of operations, absence of errors)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/idea_of_garbage_collection?rev=1260745986&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-12-14T00:13:06+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:idea_of_garbage_collection</title>
        <link>https://lara.epfl.ch/w/compilation/idea_of_garbage_collection?rev=1260745986&amp;do=diff</link>
        <description>Idea of Garbage Collection

Idea:

	*  'free' violates memory-safety and type-safety
	*  instead, let the run-time system automatically free memory that is guaranteed not  to be used any more
	*  memory that will not be used is called garbage
	*  algorithms that reclaim such memory are</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/implementing_finite_state_machines?rev=1222190088&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-23T19:14:48+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:implementing_finite_state_machines</title>
        <link>https://lara.epfl.ch/w/compilation/implementing_finite_state_machines?rev=1222190088&amp;do=diff</link>
        <description>Implementing Finite State Machines

Using an Array

The state of finite state machine is a mutable variable.

Assume:

	*  State - type denoting states
	*  Char - denotes symbols of alphabet

Behavior is given by a big array delta
delta : Array[State,Array[Char,State]]</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/incremenatal_garbage_collectors?rev=1229301293&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-15T01:34:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:incremenatal_garbage_collectors</title>
        <link>https://lara.epfl.ch/w/compilation/incremenatal_garbage_collectors?rev=1229301293&amp;do=diff</link>
        <description>Incremenatal Garbage Collectors

Goal: reduce pause times

Do not stop the program to do garbage collection

Instead, perform steps of garbage collection as the program is running

Consider this situation:

	*  collector already processes reachable node x and its fields</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/initialization_analysis?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:initialization_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/initialization_analysis?rev=1429630495&amp;do=diff</link>
        <description>Initialization Analysis

We follow the methodology of Designing Correct Data-Flow Analyses

Defining Properties of Interest

We represent program execution as a sequence of states  and simple statements , starting with the initial state

Given a sequence



we say that variable  is initialized</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/instruction_selection?rev=1228703530&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-08T03:32:10+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:instruction_selection</title>
        <link>https://lara.epfl.ch/w/compilation/instruction_selection?rev=1228703530&amp;do=diff</link>
        <description>Instruction Selection

A systematic way to select one of the many ways to translate basic block computations

Note:

	*  instructions can do several simple steps at once
	*  computed expressions also do several things at once

Goal: represent expressions using instructions</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/internal?rev=1229450488&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-16T19:01:28+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:internal</title>
        <link>https://lara.epfl.ch/w/compilation/internal?rev=1229450488&amp;do=diff</link>
        <description>Teaching Staff Page for Compiler Construction

Grading: Friday Thursday mornings

Grades

Groups

	*  Burgener, Raphaël &amp; Favre, Ludovic (#01)
	*  Chappuis, Daniel &amp; Testuz, Stéphane (#02)
	*  Köksal, Ali Sinan &amp; Kneuss, Etienne (#03)
	*  Kviatkevitch, Ivan &amp; Bindschaedler, Laurent (#04)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/internal_grading?rev=1222867639&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-01T15:27:19+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:internal_grading</title>
        <link>https://lara.epfl.ch/w/compilation/internal_grading?rev=1222867639&amp;do=diff</link>
        <description>Grades

Info is partially duplicated from Moodle.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/interpreter.scala?rev=1222428116&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:21:56+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:interpreter.scala</title>
        <link>https://lara.epfl.ch/w/compilation/interpreter.scala?rev=1222428116&amp;do=diff</link>
        <description>package whilelang;

object Interpreter {
  // add as many helper methods and values/variables as you want...

  def apply(stat: Statement): Unit = {
    // &quot;runs&quot; the program described by stat...
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/interpreting_cfg?rev=1226884731&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-17T02:18:51+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:interpreting_cfg</title>
        <link>https://lara.epfl.ch/w/compilation/interpreting_cfg?rev=1226884731&amp;do=diff</link>
        <description>Interpreting Control-Flow Graphs

Standard Execution

Running 
i = 0;
while (i &lt; 5) {
  i = i + 1;
}
Running Collatz example

A path through graph

A trace for a given path: add states of variables

An execution trace through control-flow graph

Computing Reachable States by Execution</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/interpreting_control-flow_graphs?rev=1226505616&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-12T17:00:16+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:interpreting_control-flow_graphs</title>
        <link>https://lara.epfl.ch/w/compilation/interpreting_control-flow_graphs?rev=1226505616&amp;do=diff</link>
        <description>Interpreting Control-Flow Graphs

Here is a Scala interpreter for control-flow graphs.

Standard version with program counter.

Accumulating semantics version.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/interpreting_ll_parsing_table?rev=1223148668&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-04T21:31:08+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:interpreting_ll_parsing_table</title>
        <link>https://lara.epfl.ch/w/compilation/interpreting_ll_parsing_table?rev=1223148668&amp;do=diff</link>
        <description>Interpreting LL Parsing Table

Computed parse table in 'choice' matrix, as in Building LL Parsing Table

This is the top-down parser:


var stack : Stack[GrammarSymbol]
stack.push(EOF);
stack.push(StartNonterminal);
lex = new Lexer(inputFile)
while (true) {
  X = stack.pop
  t = lex.curent
  if isTerminal(X)
    if (t==X) 
      if (X==EOF) return success
      else lex.next // eat token t
    else
      parseError(&quot;Expected &quot; + X)
  else // non-terminal
    cs = choice(X)(t)
    cs match {
    …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/isquares.while?rev=1223145604&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-04T20:40:04+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:isquares.while</title>
        <link>https://lara.epfl.ch/w/compilation/isquares.while?rev=1223145604&amp;do=diff</link>
        <description>i = 0; j = 0; while (i - 10) {
  i = i + 1; j = j + 2*i+1;
  println(j);}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/jahobparser.yy?rev=1223237708&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T22:15:08+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:jahobparser.yy</title>
        <link>https://lara.epfl.ch/w/compilation/jahobparser.yy?rev=1223237708&amp;do=diff</link>
        <description>/* Joust: a Java lexer, parser, and pretty-printer written in OCaml
   Copyright (C) 2001  Eric C. Cooper &lt;ecc@cmu.edu&gt;
   Released under the GNU General Public License */

/* LALR(1) (ocamlyacc) grammar for Java

   Attempts to conform to:

   The Java Language Specification
   Second Edition

   James Gosling, Bill Joy, Guy Steele, Gilad Bracha */

/* adapted for use with Jahob by Viktor Kuncak, 2005-2008 */

%{
(** Joust parser, generated with ocamlyacc. *)

open List
open Syntax
%}

%token &lt;…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/java_definite_assignments?rev=1227635421&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T18:50:21+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:java_definite_assignments</title>
        <link>https://lara.epfl.ch/w/compilation/java_definite_assignments?rev=1227635421&amp;do=diff</link>
        <description>Java Definite Assignments

Consider examples from:
Definite Assignments from Java Language Specification

We ignore the question of making sure that final values are initialized

	*  focus on making sure that local variables are initialized before their first use

The specification gives a particular precision of data-flow analysis that a compiler must implement to correctly report uninitialized variables</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/java_example_for_semantic_analysis?rev=1223875320&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T07:22:00+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:java_example_for_semantic_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/java_example_for_semantic_analysis?rev=1223875320&amp;do=diff</link>
        <description>Java Example for Semantic Analysis

What does this program compute?


class Example {
    boolean x;
    int y;
    int z;

    int compute(int x, int y) {
	int z = 3;
	return x + y + z;
    }
    public void main() {
	int res;
	x = true;
	y = 10;
	z = 17;
	res = compute(z, z+1);
	System.out.println(res);
    }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/javacc?rev=1221154193&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-11T19:29:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:javacc</title>
        <link>https://lara.epfl.ch/w/compilation/javacc?rev=1221154193&amp;do=diff</link>
        <description>JavaCC

Is a compiler compiler: generates lexers and parsers.

URL: &lt;https://javacc.dev.java.net/&gt;

It has been used for realistic Java parsers and is used in the Tiger book.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/jvm_classfile_construction_library?rev=1225674639&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T02:10:39+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:jvm_classfile_construction_library</title>
        <link>https://lara.epfl.ch/w/compilation/jvm_classfile_construction_library?rev=1225674639&amp;do=diff</link>
        <description>JVM Classfile Construction Library

Will be provided for the project

Makes construction of class files easier

	*  e.g. no need to know binary instruction opcodes

Documentation will appear here soon</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/jvm_instructions?rev=1225678855&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T03:20:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:jvm_instructions</title>
        <link>https://lara.epfl.ch/w/compilation/jvm_instructions?rev=1225678855&amp;do=diff</link>
        <description>JVM Instructions Reference

From JVM Spec:

	*  JVM Instruction Summary 
	*  Example instruction descriptions: 
		*  iadd
		*  imul
		*  iload
		*  istore
		*  bipush


JVM Instruction Description from JavaTech book

What instructions operate on:

	*  operands that are part of instruction itself, following their op code (unique number for instruction)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/jvm_spec?rev=1353453872&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-11-21T00:24:32+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:jvm_spec</title>
        <link>https://lara.epfl.ch/w/compilation/jvm_spec?rev=1353453872&amp;do=diff</link>
        <description>The Java Virtual Machine Specification

	*  The complete JVM specification. Instruction list is in Chapter 6 (as of 2012)
	*  opcodes arranged conveniently, in particular:by function
	*  Cafebabe documentation

You can also consult Appendix B of the book:

Aarne Ranta: Implementing Programming Languages, Texts in Computing 16, College Publications, 2012</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab02-compiler.scala?rev=1222427955&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:19:15+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab02-compiler.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab02-compiler.scala?rev=1222427955&amp;do=diff</link>
        <description>package minijava

import lexer.Lexer

class Compiler extends Reporter with Lexer {
  import lexer.Tokens._
  
  def printTokens: Unit = {
    var t: Token = Token(BAD)
    do {
      t = nextToken
      print(t.kind + &quot;(&quot; + t.row + &quot;,&quot; + t.col + &quot;) &quot;)
    } while(t.kind != EOF)
      
    terminateIfErrors
  }  
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab02-factorial.java?rev=1222196814&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-23T21:06:54+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab02-factorial.java</title>
        <link>https://lara.epfl.ch/w/compilation/lab02-factorial.java?rev=1222196814&amp;do=diff</link>
        <description>class Factorial {
	public static void main(String[] a) {
		System.out.println(new Fac().ComputeFac(10));
	}
}

class Fac { // end-of-line comment
	public int ComputeFac(int num) {
		int num_aux;
		if(num &lt; 1) /* block 
 comment */	num_aux = 1;
		else
			num_aux = num * (this.ComputeFac(num-1));
		return num_aux;
	}
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab02-lexer.scala?rev=1222427938&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:18:58+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab02-lexer.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab02-lexer.scala?rev=1222427938&amp;do=diff</link>
        <description>package minijava.lexer

import java.io.{InputStream, IOException}

trait Lexer {
  // This indicates to the compiler that this trait will be composed
  // with a Reporter. This implies that the methods from the Reporter
  // trait will be available at run-time.
  self: Reporter =&gt;
  
  import Tokens._
   
  // the input stream
  private var in: InputStream = _
  
  /** Sets the input stream to use for lexing. */
  def setInputStream(input: InputStream): Unit = {
    in = input
    // ...
  }
   …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab02-main.scala?rev=1222428057&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:20:57+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab02-main.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab02-main.scala?rev=1222428057&amp;do=diff</link>
        <description>package minijava

import java.io.{FileInputStream,IOException}

object Main {
  def main(args: Array[String]) {
    val compUnit = new Compiler()
    
    if (args.length != 1)
      compUnit.fatalError(&quot;usage: scala minijava.Main &lt;File.java&gt;&quot;)
    try {
      val in = new FileInputStream(args(0))
      compUnit.setInputStream(in)
      
      compUnit.printTokens
      
      in.close()
    } catch {
      case e: IOException =&gt; compUnit.fatalError(e.getMessage)
    }
    
    compUnit.terminat…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab02-positional.scala?rev=1222427873&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:17:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab02-positional.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab02-positional.scala?rev=1222427873&amp;do=diff</link>
        <description>package minijava

/** This trait applies to every object to which a corresponding position
 * in the input source file can be associated. This information is useful
 * in error messages, for instance. */
trait Positional {
  self =&gt;
  var row: Int = -1
  var col: Int = -1
  
  def setPos(row: Int, col: Int): Unit = {
    this.row = row
    this.col = col
  }
  
  /** Copies the position from another Positional object. Returns the
   * object on which the setPos method was called. */
  def setPos…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab02-reporter.scala?rev=1222427805&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:16:45+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab02-reporter.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab02-reporter.scala?rev=1222427805&amp;do=diff</link>
        <description>package minijava

trait Reporter {
  private var foundErrors = false
  
  /** Simple warnings */
  def warn(msg: String) = outputErrorMsg(&quot;Warning&quot;, msg)
  def warn(msg: String, pos: Positional) = outputErrorMsg(&quot;Warning&quot;, msg, pos)
  
  /** Non-fatal errors. The compiler should call terminateIfErrors
   * before the errors can have an impact (for instance at the end
   * of the phase). */
  def error(msg: String) = { foundErrors = true; outputErrorMsg(&quot;Error&quot;, msg) }
  def error(msg: String, po…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab02-tokens.scala?rev=1222428012&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:20:12+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab02-tokens.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab02-tokens.scala?rev=1222428012&amp;do=diff</link>
        <description>package minijava.lexer

object Tokens {
  sealed abstract class TokenKind
  case object BAD extends TokenKind   /* represents incorrect tokens. */
  case object EOF extends TokenKind
  case object SEMICOLON extends TokenKind   /* ; */

  /* etc. */

  case class ID(value: String) extends TokenKind   /* Identifiers */

  /* etc. */
  
  /* A Token is a positional wrapper around a TokenKind */
  class Token(val kind: TokenKind) extends Positional
  
  /* Used to create tokens by writing simply: To…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab04-compiler.scala?rev=1223425915&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-08T02:31:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab04-compiler.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab04-compiler.scala?rev=1223425915&amp;do=diff</link>
        <description>package minijava

import parser.Parser

class Compiler extends Reporter with Parser</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab04-main.scala?rev=1223425853&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-08T02:30:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab04-main.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab04-main.scala?rev=1223425853&amp;do=diff</link>
        <description>package minijava

import java.io.{FileInputStream,IOException,ByteArrayInputStream}

object Main {
  def main(args: Array[String]) {
    val compUnit = new Compiler()
    
    var parsedTree: Option[parser.Trees.Tree] = None
    
    if (args.length != 1)
      compUnit.fatalError(&quot;usage: scala minijava.Main &lt;File.java&gt;&quot;)
    try {
      val in = new FileInputStream(args(0))
      parsedTree = Some(compUnit.parseInputStream(in))
      println(TreePrinter(parsedTree.get))
      in.close()
    } c…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab04-parser.scala?rev=1223468438&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-08T14:20:38+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab04-parser.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab04-parser.scala?rev=1223468438&amp;do=diff</link>
        <description>package minijava.parser

import minijava.lexer.Lexer

import java.io.{InputStream,IOException}

/** LL(2) parser for the MiniJava+ grammar. */
trait Parser extends Lexer {
  self: Reporter =&gt;
  
  import Trees._
  import minijava.lexer.Tokens._
  
  def parseInputStream(in: InputStream): Tree = {
    setInputStream(in) // from Lexer

    /* ... */

    val tree: Tree = parseGoal
    tree
  }
  
  /** Store the currentToken (first lookahead), and upcomingToken (second lookahead), as read from the…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab04-prettyprinter.scala?rev=1223425767&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-08T02:29:27+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab04-prettyprinter.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab04-prettyprinter.scala?rev=1223425767&amp;do=diff</link>
        <description>package minijava

object TreePrinter {
  import parser.Trees._
  
  def apply(t: Tree): String = {
    /* construct and return the appropriate string ... */
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab04-tokens.scala?rev=1223424449&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-08T02:07:29+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab04-tokens.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab04-tokens.scala?rev=1223424449&amp;do=diff</link>
        <description>package minijava.lexer

object Tokens {
  sealed trait TokenClass {
    self =&gt;
    def tokenClass: self.type = self
  }
  
  case object IDCLASS extends TokenClass { override def toString: String = &quot;identifier&quot; }
  case object NUMLITCLASS extends TokenClass { override def toString: String = &quot;integer literal&quot; }
  case object STRLITCLASS extends TokenClass { override def toString: String = &quot;string literal&quot; }}
  
  sealed trait TokenInfo {
    def tokenClass: TokenClass
  }
  
  case object BAD ex…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab04-trees.scala?rev=1223424667&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-08T02:11:07+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab04-trees.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lab04-trees.scala?rev=1223424667&amp;do=diff</link>
        <description>package minijava.parser

object Trees {
  sealed trait Tree extends Positional
    
  case class Program(main: MainClass, classes: List[ClassDecl]) extends Tree
  case class MainClass(id: Identifier, mainarg: Identifier, stat: StatTree) extends Tree
  /* etc. */

  sealed trait TypeTree extends Tree
  
  case class IntType extends TypeTree
  /* etc. */
  
  sealed trait StatTree extends Tree
  
  case class Block(stats: List[StatTree]) extends StatTree
  /* etc. */
  
  sealed trait ExprTree ext…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab06analyzer?rev=1224650684&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-22T06:44:44+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab06analyzer</title>
        <link>https://lara.epfl.ch/w/compilation/lab06analyzer?rev=1224650684&amp;do=diff</link>
        <description>package minijava.analyzer

trait Analyzer {
  self: Reporter =&gt;
  
  import parser.Trees._
  import Symbols._
  
  def analyzeSymbols(prog: Program): GlobalScope = {
    val gs = collectSymbols(prog)
    terminateIfErrors
    setSymbols(prog, gs)
    gs
  }

  private def collectSymbols(prog: Program): GlobalScope = /* ... */

  private def setSymbols(prog: Program, gs: GlobalScope): Unit = /* ... */
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab06compilerstub?rev=1224651293&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-22T06:54:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab06compilerstub</title>
        <link>https://lara.epfl.ch/w/compilation/lab06compilerstub?rev=1224651293&amp;do=diff</link>
        <description>package minijava

import parser.Parser
import analyzer.Analyzer

class Compiler extends Reporter with Parser with Analyzer {
  import java.io.{FileInputStream,IOException,ByteArrayInputStream}

  def compile(fileName: String): Unit = {
    import parser.Trees._
    import analyzer.Symbols._
    
    // Parsing
    var parsedTree: Option[Tree] = None
    try {
      val in = new FileInputStream(fileName)
      parsedTree = Some(parseInputStream(in))
      in.close()
    } catch {
      case e: IO…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab06mainstub?rev=1224651327&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-22T06:55:27+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab06mainstub</title>
        <link>https://lara.epfl.ch/w/compilation/lab06mainstub?rev=1224651327&amp;do=diff</link>
        <description>package minijava

object Main {
  def main(args: Array[String]) {
    val compUnit = new Compiler()
    
    var parsedTree: Option[parser.Trees.Tree] = None
    
    if (args.length != 1)
      compUnit.fatalError(&quot;usage: scala minijava.Main &lt;File.java&gt;&quot;)
    
    compUnit.compile(args(0))
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab06symbols?rev=1224656931&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-22T08:28:51+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab06symbols</title>
        <link>https://lara.epfl.ch/w/compilation/lab06symbols?rev=1224656931&amp;do=diff</link>
        <description>package minijava.analyzer

import scala.collection.mutable.HashMap

object Symbols {
  /** A trait for anything that refers to a symbol. */
  trait Symbolic[S &lt;: Symbol] {
    self =&gt;
    
    private var _sym: Option[S] = None
    
    def setSymbol(sym: S): self.type = {
      _sym = Some(sym)
      this
    }
    
    def getSymbol: S = _sym match {
      case Some(s) =&gt; s
      case None =&gt; scala.Predef.error(&quot;Accessing undefined symbol.&quot;)
    } 
  }
  
  /** Notice that creating a symbol wi…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab06treeprinter?rev=1224651259&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-22T06:54:19+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab06treeprinter</title>
        <link>https://lara.epfl.ch/w/compilation/lab06treeprinter?rev=1224651259&amp;do=diff</link>
        <description>package minijava

object TreePrinter {
  import parser.Trees._
  
  /** TreePrinter(tree) will produce the same result as before. */
  def apply: (Tree=&gt;String) = apply(false)_
  
  /** TreePrinter.withSymbolIDs(tree) will print the tree with the IDs. */
  def withSymbolIDs: (Tree=&gt;String) = apply(true)_
  
  /** We added a parameter and currified the method to build the other two. */
  private def apply(withSymbolIDs: Boolean)(t: Tree) = {
    /* code you had before... */

    // ...

    // Th…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab06trees?rev=1224650904&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-22T06:48:24+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab06trees</title>
        <link>https://lara.epfl.ch/w/compilation/lab06trees?rev=1224650904&amp;do=diff</link>
        <description>package minijava.parser

object Trees {
  import analyzer.Symbols._
  
  sealed trait Tree extends Positional

  // You should of course not copy this file into your project.
  // Rather, observe how the symbols of the proper symbol types are
  // attached to the trees, and reproduce this by adapting it to your own AST nodes. 

  // ...

  case class MainClass(id: Identifier, mainarg: Identifier, stat: StatTree) extends Tree with Symbolic[ClassSymbol]
  case class ClassDecl(id: Identifier, paren…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab08-compiler?rev=1225248287&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-29T03:44:47+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab08-compiler</title>
        <link>https://lara.epfl.ch/w/compilation/lab08-compiler?rev=1225248287&amp;do=diff</link>
        <description>package minijava

import parser.Parser
import analyzer.Analyzer
import analyzer.TypeChecker

class Compiler
    extends Reporter
    with Parser
    with Analyzer
    with TypeChecker {
  import java.io.{FileInputStream,IOException,ByteArrayInputStream}

  def compile(fileName: String): Unit = {
    import parser.Trees._
    import analyzer.Symbols._
    
    // Parsing
    var parsedTree: Option[Tree] = None
    try {
      val in = new FileInputStream(fileName)
      parsedTree = Some(parseInp…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab08-typechecker?rev=1225249441&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-29T04:04:01+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab08-typechecker</title>
        <link>https://lara.epfl.ch/w/compilation/lab08-typechecker?rev=1225249441&amp;do=diff</link>
        <description>package minijava.analyzer

trait TypeChecker {
  self: Reporter =&gt;
  
  import Symbols._
  import Types._
  import parser.Trees._
  
  /** Typechecking does not produce a value, but has the side effect of
   * attaching types to trees and potentially outputting error messages. */
  def typeCheck(prog: Program, gs: GlobalScope): Unit = {

    /** Suggested inner function:
     *
     * Computes the type of an expression. If exp is not empty, checks that
     * the expression is a subtype of one i…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab08-types?rev=1225248761&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-29T03:52:41+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab08-types</title>
        <link>https://lara.epfl.ch/w/compilation/lab08-types?rev=1225248761&amp;do=diff</link>
        <description>package minijava.analyzer

object Types {
  import Symbols._
  
  sealed abstract class Type {
    // we suggest you implement this to make type checking easier
    def isSubTypeOf(tpe: Type): Boolean
  }

  // having this &quot;bottom&quot; class (which extends every other one) can be convenient for error recovery...
  case object TError extends Type {
    override def isSubTypeOf(tpe: Type): Boolean = true
    override def toString = &quot;[error]&quot;
  }
  
  // the default type for all Typed objects
  case ob…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab09-codegen?rev=1226334208&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T17:23:28+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab09-codegen</title>
        <link>https://lara.epfl.ch/w/compilation/lab09-codegen?rev=1226334208&amp;do=diff</link>
        <description>package minijava.code

trait CodeGenerator {
  self: Reporter =&gt;

  import parser.Trees._
  import analyzer.Symbols._
  import analyzer.Types._
  import cafebabe._

  // Bytecodes
  import AbstractByteCodes._
  import ByteCodes._

  /** Writes the proper .class file in a given directory. An empty string for dir is equivalent to &quot;./&quot;. */
  def generateClassFile(gs: GlobalScope, ct: ClassDecl, dir: String): Unit = {

    // ...

  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab09-compiler?rev=1226334293&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T17:24:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab09-compiler</title>
        <link>https://lara.epfl.ch/w/compilation/lab09-compiler?rev=1226334293&amp;do=diff</link>
        <description>package minijava

import parser.Parser
import analyzer.Analyzer
import analyzer.TypeChecker
import code.CodeGenerator

class Compiler
    extends Reporter
    with Parser
    with Analyzer
    with TypeChecker
    with CodeGenerator {
  import java.io.{File,FileInputStream,IOException,ByteArrayInputStream}

  def compile(fileName: String, classDir: String): Unit = {
    import parser.Trees._
    import analyzer.Symbols._

    val outputDir = classDir + &quot;/&quot;
    
    val checkDir: File = new File(…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab09-main?rev=1226334324&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T17:25:24+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab09-main</title>
        <link>https://lara.epfl.ch/w/compilation/lab09-main?rev=1226334324&amp;do=diff</link>
        <description>package minijava

object Main {
  def main(args: Array[String]) {
    val compUnit = new Compiler()
    
    var parsedTree: Option[parser.Trees.Tree] = None
    
    if (args.length != 1 &amp;&amp; args.length != 3) {
      compUnit.fatalError(&quot;usage: minijavac &lt;File.java&gt; [-d outputdir]&quot;)
    }
    
    if(args.length == 1) {
      compUnit.compile(args(0), &quot;./&quot;)
    } else {
      if(!&quot;-d&quot;.equals(args(1))) {
        compUnit.fatalError(&quot;Unrecognized option: &quot; + args(1))
      }
      compUnit.compile…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab11-asttocfgstub?rev=1227632355&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T17:59:15+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab11-asttocfgstub</title>
        <link>https://lara.epfl.ch/w/compilation/lab11-asttocfgstub?rev=1227632355&amp;do=diff</link>
        <description>package minijava.controlflow

object ASTtoCFG {
  import parser.Trees._
  import analyzer.Symbols._
  import analyzer.Types._
  import CFGTrees._
  
  /** Builds a control flow graph from a method declaration. */
  def convertAST(meth: MethodDecl): CFG = {
    val cfg: CFG = new CFG
    
    type Vertex = cfg.Vertex
    
    /** Creates fresh variable names on demand. */
    object FreshName {
      var count = 0
      
      def apply(prefix: String): String = {
        val post = count
       …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab11-cfg?rev=1227632034&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T17:53:54+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab11-cfg</title>
        <link>https://lara.epfl.ch/w/compilation/lab11-cfg?rev=1227632034&amp;do=diff</link>
        <description>package minijava.controlflow

import CFGTrees._

class CFG extends LabeledDirectedGraphImp[CFGStatement] {
  val entry: Vertex = newVertex
  val exit: Vertex = newVertex
  entry.name = &quot;entry&quot;
  exit.name = &quot;exit&quot;
  override def toString = &quot;[&gt;&quot; + entry + super.toString + exit + &quot;&lt;]&quot;    
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab11-cfgtrees?rev=1227632058&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T17:54:18+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab11-cfgtrees</title>
        <link>https://lara.epfl.ch/w/compilation/lab11-cfgtrees?rev=1227632058&amp;do=diff</link>
        <description>package minijava.controlflow

object CFGTrees {
  import analyzer.Symbols._
  import analyzer.Types._
  
  sealed abstract class CFGTree {
    override def toString = stringRepr(this)
  }
  
  sealed abstract class CFGStatement extends CFGTree
  case class CFGAssign(variable: CFGVariable, expr: CFGExpression) extends CFGStatement
  
  case class CFGAssignBinary(variable: CFGVariable,
                             lhs: CFGSimpleValue,
                             binOp: CFGBinaryOperator,
        …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab11-compmods?rev=1227633409&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T18:16:49+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab11-compmods</title>
        <link>https://lara.epfl.ch/w/compilation/lab11-compmods?rev=1227633409&amp;do=diff</link>
        <description>// ...
  def compile(fileName: String, classDir: String): Unit = {
    // ...

    // Adapt this to your class hierarchy and add it after the type checking code.
    // You can also comment out the class files generation for this lab to save some time.

    mainProg.classes.foreach(ct =&gt; {
      ct.methods.foreach(m =&gt; {
        val cfg = controlflow.ASTtoCFG.convertAST(m)
        cfg.writeDottyToFile(ct.getSymbol.name + &quot;-&quot; + m.getSymbol.name + &quot;.dot&quot;)
      })
    })

    // ...
  }
// ...</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab11-dfa?rev=1228283230&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-03T06:47:10+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab11-dfa</title>
        <link>https://lara.epfl.ch/w/compilation/lab11-dfa?rev=1228283230&amp;do=diff</link>
        <description>package minijava.controlflow 

abstract class TransferFunction[L, CFGStatement] {
  def apply(node : CFGStatement, x : L) : L
}
 
class AnalysisAlgoritm[L,CFGStatement]
               (transferFun : TransferFunction[L, CFGStatement],
		lattice : Lattice{type Elem=L},
		cfg : LabeledDirectedGraphImp[CFGStatement])
{
  type Vertex = VertexImp[CFGStatement]
  
  var facts : Map[Vertex, L] = Map[Vertex,L]()
  
  def init = {
    facts = Map[Vertex,L]().withDefaultValue(lattice.bottom)
  }
  
  def s…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab11-labeleddirectedgraph?rev=1228283110&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-03T06:45:10+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab11-labeleddirectedgraph</title>
        <link>https://lara.epfl.ch/w/compilation/lab11-labeleddirectedgraph?rev=1228283110&amp;do=diff</link>
        <description>package minijava.controlflow

/** Mutable Directed Graph with Labels */
abstract trait LabeledDirectedGraph[LabelType] {
  /** The type of the vertices */
  type Vertex
  /** The type of the edges */
  type Edge
  /** The vertices */
  def V: Set[Vertex]
  /** The edges */
  def E: Set[Edge]
  /** Adds a new vertex to the graph */
  def newVertex: Vertex
  /** Adds a new labeled edge between two vertices */
  def += (from: Vertex, lab: LabelType, to: Vertex)
  /** Returns the set of incoming edg…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab11-lattices?rev=1228283189&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-03T06:46:29+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab11-lattices</title>
        <link>https://lara.epfl.ch/w/compilation/lab11-lattices?rev=1228283189&amp;do=diff</link>
        <description>package minijava.controlflow

trait PartialOrder {
  type Elem
  def leq(x : Elem, y : Elem) : Boolean // less than or equal
}
trait Lattice extends PartialOrder {
  val top : Elem                        // universal set
  val bottom : Elem                     // empty set
  def join(x : Elem, y : Elem) : Elem   // union
  def meet(x : Elem, y : Elem) : Elem   // intersection
}
 
// there should be more elegant definition--but make sure domain of results are correct
class PointwiseLattice[I,E,L …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lab11-ldg?rev=1227631999&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T17:53:19+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lab11-ldg</title>
        <link>https://lara.epfl.ch/w/compilation/lab11-ldg?rev=1227631999&amp;do=diff</link>
        <description>package minijava.controlflow

/** Mutable Directed Graph with Labels */
abstract trait LabeledDirectedGraph[LabelType] {
  /** The type of the vertices */
  type Vertex
  /** The type of the edges */
  type Edge
  /** The vertices */
  def V: Set[Vertex]
  /** The edges */
  def E: Set[Edge]
  /** Adds a new vertex to the graph */
  def newVertex: Vertex
  /** Adds a new labeled edge between two vertices */
  def += (from: Vertex, lab: LabelType, to: Vertex)
  /** Returns the set of incoming edg…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_01?rev=1221631958&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-17T08:12:38+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_01</title>
        <link>https://lara.epfl.ch/w/compilation/labs_01?rev=1221631958&amp;do=diff</link>
        <description>Labs 01

This week you will build an interpreter in Scala for the while language described in Lecture 01. You don't have to write a lexer/parser, as you will instead work directly on the Abstract Syntax Tree (AST) representation of programs. The language is slightly different here as we have added</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_02?rev=1222418471&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T10:41:11+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_02</title>
        <link>https://lara.epfl.ch/w/compilation/labs_02?rev=1222418471&amp;do=diff</link>
        <description>Labs 02

This assignment is the first part of the MiniJava+ compiler project. Make sure you read the general project overview page first. Please also send Philippe an email as soon as possible stating who are the (two) members of your group.

Test case corpus (due in one week)

Write two small MiniJava+ programs per person (four per group) to constitute a corpus of test cases that we will use throughout the compiler project. We will check that all benchmarks are correct MiniJava+ programs and di…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_03?rev=1222689398&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-29T13:56:38+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_03</title>
        <link>https://lara.epfl.ch/w/compilation/labs_03?rev=1222689398&amp;do=diff</link>
        <description>Labs 03

Finish Labs 02.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_04?rev=1223644797&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-10T15:19:57+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_04</title>
        <link>https://lara.epfl.ch/w/compilation/labs_04?rev=1223644797&amp;do=diff</link>
        <description>Labs 04

This week and the next one, you'll work on the second part of the MiniJava+ Compiler Project. Your goal is to manually implement a recursive-descent parser to transform programs described by the MiniJava+ grammar into Abstract Syntax Trees. You also need to write a pretty-printer for these trees. This assignment is rather long and we can only recommend that you start early, that you make sure you understand every step and that you ask otherwise.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_05?rev=1223681645&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-11T01:34:05+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_05</title>
        <link>https://lara.epfl.ch/w/compilation/labs_05?rev=1223681645&amp;do=diff</link>
        <description>Labs 05

Finish Labs 04.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_06?rev=1225818214&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-04T18:03:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_06</title>
        <link>https://lara.epfl.ch/w/compilation/labs_06?rev=1225818214&amp;do=diff</link>
        <description>Labs 06

This week you will add name analysis to your MiniJava+ compiler. This will considerably ease the task of type checking that you will start next week or the week after. Your analyzer is due on Wednesday, Nov. 5th, 8.15am.

The description of this assignment is rather long. Don't panic :) Most of it is to help you avoid forgetting important points, and we give you a substantial amount of code.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_07?rev=1225134125&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-27T20:02:05+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_07</title>
        <link>https://lara.epfl.ch/w/compilation/labs_07?rev=1225134125&amp;do=diff</link>
        <description>Labs 07

Finish labs 06 or start labs 08.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_08?rev=1225876827&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-05T10:20:27+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_08</title>
        <link>https://lara.epfl.ch/w/compilation/labs_08?rev=1225876827&amp;do=diff</link>
        <description>Well, for some definition of (in)valid.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_09?rev=1227534833&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-24T14:53:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_09</title>
        <link>https://lara.epfl.ch/w/compilation/labs_09?rev=1227534833&amp;do=diff</link>
        <description>Labs 09

Congratulations, your front-end is complete! You are now one step (and two weeks) away from having written a complete compiler. This week's lab description and stubs are rather short. It's not that we don't want to help you anymore, it's just that the tasks should be straightforward :)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_10?rev=1225734511&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T18:48:31+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_10</title>
        <link>https://lara.epfl.ch/w/compilation/labs_10?rev=1225734511&amp;do=diff</link>
        <description>Labs 10

Finish labs 09.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_11?rev=1227640993&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T20:23:13+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_11</title>
        <link>https://lara.epfl.ch/w/compilation/labs_11?rev=1227640993&amp;do=diff</link>
        <description>Labs 11

Today, Nov 26th, you hand in a working MiniJava+ to JVM compiler, congratulations! Hopefully it will do well in the cc08 competition.

This week you will write a translation from your MiniJava+ ASTs to Control Flow Graphs (CFGs), similarly to what was shown for the while language in</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_12?rev=1228329612&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-03T19:40:12+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_12</title>
        <link>https://lara.epfl.ch/w/compilation/labs_12?rev=1228329612&amp;do=diff</link>
        <description>Labs 12

This is the last lab, you're almost there :) Due date is Saturday, Jan. 10th, 2009.

In this lab, you will implement range analysis, and will use it to try and prevent potential ArrayIndexOutOfBoundsExceptions.

The lab can seem long at first, but if you follow the steps you should be just fine. The starting one (adding</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_13?rev=1228387299&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-04T11:41:39+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_13</title>
        <link>https://lara.epfl.ch/w/compilation/labs_13?rev=1228387299&amp;do=diff</link>
        <description>Labs 13

No more labs, finish Labs 12.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/labs_14?rev=1225734786&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T18:53:06+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:labs_14</title>
        <link>https://lara.epfl.ch/w/compilation/labs_14?rev=1225734786&amp;do=diff</link>
        <description>Labs 14, aka. final written exam

No labs this week. Answer the questions in the exam instead.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lambda_calculi_with_types?rev=1224609207&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-21T19:13:27+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lambda_calculi_with_types</title>
        <link>https://lara.epfl.ch/w/compilation/lambda_calculi_with_types?rev=1224609207&amp;do=diff</link>
        <description>Lambda Calculi with Types

[Henk Barendregt: Lambda Calculi with Types]</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lambda_calculus?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lambda_calculus</title>
        <link>https://lara.epfl.ch/w/compilation/lambda_calculus?rev=1429630495&amp;do=diff</link>
        <description>Lambda Calculus

Lambda calculus is a simple and powerful notation for defining functions.  Among its uses are

	*  foundation of programming languages, especially functional languages such as Ocaml, Haskell, and Scala
	*  basis of higher order logic</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/languages_using_prefix_or_postfix_only?rev=1225651259&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-02T19:40:59+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:languages_using_prefix_or_postfix_only</title>
        <link>https://lara.epfl.ch/w/compilation/languages_using_prefix_or_postfix_only?rev=1225651259&amp;do=diff</link>
        <description>Languages using Prefix or Postfix Only

Prefix: LISP

LISP (1958) =

	*  LISt Processing
	*  Lost In Single Parentheses

50th anniversary of LISP

	*  recursive definitions
	*  lists as data structure for symbolic processing
	*  widely used in AI
	*  introduced automated memory management</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lattices.scala?rev=1227491406&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-24T02:50:06+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lattices.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lattices.scala?rev=1227491406&amp;do=diff</link>
        <description>trait PartialOrder {
  type Elem
  def leq(x : Elem, y : Elem) : Boolean // less than or equal
}
trait Lattice extends PartialOrder {
  val top : Elem                        // universal set
  val bottom : Elem                     // empty set
  def join(x : Elem, y : Elem) : Elem   // union
  def meet(x : Elem, y : Elem) : Elem   // intersection
}


// there should be more elegant definition--but make sure domain of results are correct
class PointwiseLattice[I,E,L &lt;: Lattice{type Elem=E}](base …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lattices_in_dataflow_analysis?rev=1226886832&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-17T02:53:52+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lattices_in_dataflow_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/lattices_in_dataflow_analysis?rev=1226886832&amp;do=diff</link>
        <description>Lattices in Dataflow Analysis

Interpreter maintains mapping from variables to states

Dataflow analysis works with abstractions of sets of states--these are elements of a lattice

Keep in mind that they are just representations of certain sets of states</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_01?rev=1221479138&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-15T13:45:38+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_01</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_01?rev=1221479138&amp;do=diff</link>
        <description>Lecture 01: Introduction and Lexical Analysis

Course Information

Compilers and Interpreters

What is a Compiler

Compilers in Action

Phases of a Compiler

Why Study Compilers

Alternatives to Compilation

Specifying Language Syntax

While Language

Abstract Syntax of While

Strings and languages

Regular expression

Tokens (Words) of While Language

Context-Free Grammars

Concrete Syntax of While

Lexical Analysis without Tools

Why Study Lexical Analysis

Hand-Written Scanner for While Langu…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_02?rev=1222250781&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-24T12:06:21+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_02</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_02?rev=1222250781&amp;do=diff</link>
        <description>Lecture 02: Automating Lexing. Intro to Parsing

Check Course Information for new resources

Continuation of Lecture 01

Recall Phases of a Compiler

Automating Lexical Analysis

State Machines from Regular Expressions (done in exercises)

Finite state machine

Determinization of finite state machine

Finite state machine with epsilon transitions

Closure properties of finite state machines

From Finite State Machines to Regular Expressions</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_03?rev=1222690845&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-29T14:20:45+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_03</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_03?rev=1222690845&amp;do=diff</link>
        <description>Lecture 03: Parsing

A classic book

Recursive Descent Parsing

CYK Parsing Algorithm

Transforming to Chomsky Normal Form

References

	*  Tiger book, Sections 3.1, 3.2
	*  Slides from previous years: english, french
	*  Compiler Construction by Niklaus Wirth, Chapter 4
	*  Compiler Construction Tools
	*  MiniJava
	*  AhoUllman</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_04?rev=1223237935&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T22:18:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_04</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_04?rev=1223237935&amp;do=diff</link>
        <description>Lecture 04: Finishing Parsing. Semantic Actions and Building Syntax Trees

Summary of Table-Driven LL(1) Parsing

Algorithm for First and Follow Sets

Building LL Parsing Table

Interpreting LL Parsing Table

Abstract Syntax Trees

Notion of Syntax Trees

Modifying Parser to Construct Trees

Building a Pretty Printer

LR Parsing Preparation

Earley Parser

Pushdown Automata

LR Parsing

LL Parser uses Leftmost Derivation

LR Parser uses Rightmost Derivation

LR Parser Runs Automaton over Stack

…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_05?rev=1255613910&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-10-15T15:38:30+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_05</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_05?rev=1255613910&amp;do=diff</link>
        <description>Lecture 05: Basic Semantic Analysis and Type Checking

Interpretation versus Semantic Analysis

Java Example for Semantic Analysis

Maps in Math

Handling Scopes in Interpreters

Semantic Analysis as Simplified Interpretation

Reporting Errors from Semantic Analysis

Reporting Errors Based on Syntax Tree

Symbol Table (Environment) Implementation

Symbol Table Contents

Functional versus Imperative Maps

An Efficient Imperative Map

An Efficient Functional Map

Efficient Comparison for Identifie…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_06?rev=1225017723&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-26T11:42:03+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_06</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_06?rev=1225017723&amp;do=diff</link>
        <description>Lecture 06: Type Checking

Typing Rules for Simple Language

Lambda Calculus

Simple Types for Lambda Calculus

Type Checking Let and Letrec

Operational Semantics of Lambda with Letrec

References

	*  Types and Programming Languages, Chapter 5, Chapter 8, Sections 9.1--9.3 (pages 89-107)
	*  Lambda Calculi with Types</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_07?rev=1225555255&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-01T17:00:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_07</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_07?rev=1225555255&amp;do=diff</link>
        <description>Type System Soundness. Subtyping

Continuing Lecture 06

Type Soundness Theorems

Proving Safety Properties using Types

Type Soundness for Simply Typed Lambda Calculus

Subtyping

Notion of Subtyping

Subtyping for Functions

Subtyping for Assignments

References

	*  [A Syntactic Approach to Type Soundness]
	*  Foundations of Software, the EPFL master's level course taught by Prof. Martin Odersky, covers type systems in great depth
	*  Types and Programming Languages, Chapter 5, Chapter 8, Sec…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_08?rev=1225710300&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T12:05:00+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_08</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_08?rev=1225710300&amp;do=diff</link>
        <description>Lecture 08: Code Generation for Stack Machines

Overview

Recall

	*  Phases of a Compiler
	*  Compilers in Action

Overview of Compiling to Stack Machine

JVM Instructions

Compiled Expression Examples

Compiled Counting Examples

Compiled Factorial Example

Compiling Expressions

VM for Expressions

Prefix Infix Postfix Notation

Printing Prefix Infix Postfix

Languages using Prefix or Postfix Only

Evaluating Postfix

Translating Expressions to Stack Machine

Translation Correctness for Expre…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_09?rev=1226336560&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T18:02:40+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_09</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_09?rev=1226336560&amp;do=diff</link>
        <description>Lecture 09: Compiling Control Flow

Recall Lecture 08

	*  today: the translation of the remaining constructs into JVM

Compiling Control-Flow Statements

Booleans and Data Representation

Linearizing Trees with Control-Flow

Branching JVM Instructions

Compiling If Then Else

Computing Labels

Compiling While

Compiling Boolean Operators

Translation of Relations

Postfix Translation of Boolean Operators

Compiling Conditional Expressions

Short-Circuit Evaluation

Better Code Generation for Co…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_10?rev=1227617320&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T13:48:40+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_10</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_10?rev=1227617320&amp;do=diff</link>
        <description>Lecture 10: Basics of Dataflow Analysis through Examples

Idea of Data Flow Analysis

Control-Flow Graph Definition

Interpreting CFG

Translating Syntax Tree to CFG

Constant Propagation

Sign Analysis

Initialization Analysis

Partial order and Lattices

Lattices in Dataflow Analysis

Continued in Lecture 11 and Lecture 12

Reference

	*  [Lecture notes on static analysis by Michael Schwartzbach]
	*  Tiger book, chapters 10, 17</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_11?rev=1227617299&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T13:48:19+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_11</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_11?rev=1227617299&amp;do=diff</link>
        <description>Lecture 11: Data-Flow Analysis in Scala

Continuation of Lecture 10

Outline:

	*  Control-Flow Graphs in Scala
	*  Translating While Language to CFG
	*  Lattices in Scala
	*  Sign Analysis 

Sources:

	*  DiGraphs.scala
	*  SimpleCFG.scala
	*  SimpleAST.scala
	*  SimpleTranslate.scala

	*  Lattices.scala
	*  DataFlowAnalysis.scala
	*  SignAnalysis.scala

Continued in Lecture 12</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_12?rev=1227636773&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T19:12:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_12</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_12?rev=1227636773&amp;do=diff</link>
        <description>Lecture 12: Applications and Methodology of Data-Flow Analysis

Continuation of Lecture 11. Recall:

	*  Lattices.scala
	*  DataflowAnalysis.scala
	*  SignAnalysis.scala

Applications of Data-Flow Analysis

Concrete Execution as Data-Flow Analysis

Designing Correct Data-Flow Analyses

Termination of Data-Flow Analysis

Java Definite Assignments

Initialization Analysis

Live Variable Analysis

Range Analysis

Typestate Analysis</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_13?rev=1228703602&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-08T03:33:22+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_13</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_13?rev=1228703602&amp;do=diff</link>
        <description>Lecture 13: Code Generation for Register Machines

Remarks:

	*  htmldoc
	*  today we talk about machine code generation

Overview of an Optimizing Compiler

Recall the Stack Machine: VM for Expressions

ARM Architecture

Register Machine in Scala

xyz Example using GCC

Control-Flow Graph to Assembly with Global Variables

Register Allocation using Liveness Information

Memory Layout for Compiled Program

Stack Frames and Procedure Calls

Local, Higher-Order, and Dispatched Procedures

Instruct…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_14?rev=1229332211&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-15T10:10:11+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_14</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_14?rev=1229332211&amp;do=diff</link>
        <description>Lecture 14: Dynamic Memory Management

Recall Memory Layout for Compiled Program

	*  we discuss how to manage the heap (dynamicaly allocated memory)
	*  essential for building structures such as linked lists, trees
	*  implementation of 'new'
	*  contrast to stack

Malloc and Free

	*  MallocInfMem.scala
	*  MallocFree.scala
	*  Free Lists by Size</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lecture_15?rev=1227621528&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T14:58:48+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lecture_15</title>
        <link>https://lara.epfl.ch/w/compilation/lecture_15?rev=1227621528&amp;do=diff</link>
        <description>Lecture 15 - Not (Necessary) Taught

This page contains the “Lecture 15” -- material that was not covered in the course

Compiling to Low-Level Object Code

Basics of Type Inference

Constraint-Based Type Checking

Note on Polymorphism and Subtyping

Misc

Trivia Bad Languages</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lexer.scala?rev=1222606521&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-28T14:55:21+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lexer.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lexer.scala?rev=1222606521&amp;do=diff</link>
        <description>class Lexer(ch : CharStream) {
  val EOL = '\n'
  val keywords = Map(&quot;while&quot; -&gt; WHILE,
		     &quot;if&quot; -&gt; IF,
		     &quot;println&quot; -&gt; PRINTLN,
		     &quot;readln&quot; -&gt; READLN)
  
  var current : Token = EOF

  private def skippedComment : Boolean = {
    if (ch.current == '/') {
      ch.next
      if (ch.current == '/') {
	ch.next
	while ((ch.current != EOL) &amp;&amp; !ch.eof) ch.next
	true
      } else {
	current = DIV
	false
      }
    } else {
      false
    }
  }

  private def skipSpaces = {
    while (((ch.…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lexerinterface.scala?rev=1221080713&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-10T23:05:13+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lexerinterface.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lexerinterface.scala?rev=1221080713&amp;do=diff</link>
        <description>class Lexer(ch : CharStream) {
  var current : Token
  def next : Unit = { ... }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lexertest.scala?rev=1221159683&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-11T21:01:23+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lexertest.scala</title>
        <link>https://lara.epfl.ch/w/compilation/lexertest.scala?rev=1221159683&amp;do=diff</link>
        <description>object LexerTest {
  def main(args : Array[String]) = {
    val lex = new Lexer(new CharStream(args(0)))
    while (lex.current != EOF) {
      println(lex.current)
      lex.next
    }
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/limitations_of_regular_expressions?rev=1222202285&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-23T22:38:05+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:limitations_of_regular_expressions</title>
        <link>https://lara.epfl.ch/w/compilation/limitations_of_regular_expressions?rev=1222202285&amp;do=diff</link>
        <description>Limitations of Regular Expressions

Parentheses in expressions, statement blocks
{{}{{{}{}}{}}}{}{{}{}}

{ {} {{{}{}}{}} }  {} {{}{}}
The language of balanced (matched) parentheses (here: curly braces)

	*  at each point count number of open minus number of closed parantheses</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/linearizing_trees_with_control-flow?rev=1226238656&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-09T14:50:56+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:linearizing_trees_with_control-flow</title>
        <link>https://lara.epfl.ch/w/compilation/linearizing_trees_with_control-flow?rev=1226238656&amp;do=diff</link>
        <description>Linearizing Trees with Control-Flow

Evaluating control-flow in interpreter is easy

	*  recall the interpreter in Labs 01
	*  recall Handling Scopes in Interpreters


statement match {
 ...
 case IfStat(cond,sThen,sElse) =&gt; {
   interpExpr(e)(cond) match {
     case BoolValue(b) =&gt; {
       if (b) {
         interpStats(e, UnitValue, sThen :: stmts1)
       } else {
         interpStats(e, UnitValue, sElse :: stmts1)
       }
     }
     case _ =&gt; error(&quot;Expected boolean as condition&quot;)
   }
 }
…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/links?rev=1219520499&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-08-23T21:41:39+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:links</title>
        <link>https://lara.epfl.ch/w/compilation/links?rev=1219520499&amp;do=diff</link>
        <description>Compilation: Useful Links

Schedule

[Official Schedule]

Official Course Description

The Team

Lectures:

	*  Viktor Kuncak

Exercises:

	*  Philippe Suter
	*  Ruzica Piskac

Assistants-Étudiants

	*  Sebastian Gfeller
	*  Cédric Lavanchy

Textbook

	*  Modern Compiler Implementation in Java (2nd Edition):
			*  Andrew Appel's web site
			*  2nd Edition from Cambridge University Press
			*  2nd Edition from Amazon.com
			*</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/live_variable_analysis?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:live_variable_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/live_variable_analysis?rev=1429630495&amp;do=diff</link>
        <description>Live Variable Analysis

For each program point, and each variable approximately compute whether the variable is live at that program point

Definition: a variable  is dynamically live in a concrete program state , if there exists a finite sequence of steps</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/ll_parser_uses_leftmost_derivation?rev=1223226307&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T19:05:07+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:ll_parser_uses_leftmost_derivation</title>
        <link>https://lara.epfl.ch/w/compilation/ll_parser_uses_leftmost_derivation?rev=1223226307&amp;do=diff</link>
        <description>LL Parser Uses Leftmost Derivation

LL parser, as given by Interpreting LL Parsing Table

	*  decides what production to use
	*  uses stack to remember this right-hand side

Parsing is opposite of grammar derivation

For grammar
E ::= T | T + E
T ::= ID
a leftmost derivation of ID+ID+ID from E is:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/llvm-intro?rev=1322840329&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-12-02T16:38:49+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:llvm-intro</title>
        <link>https://lara.epfl.ch/w/compilation/llvm-intro?rev=1322840329&amp;do=diff</link>
        <description>Introduction to Using LLVM as a Compiler Backend

Assembly and bitcode files

The LLVM intermediate representation (IR) language comes with two formats:

	*  bitcode, a binary representation, typically stored in .bc files, and
	*  assembly, an human-readable (text) representation, typically stored in</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/local_higher-order_and_dispatched_procedures?rev=1228699748&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-08T02:29:08+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:local_higher-order_and_dispatched_procedures</title>
        <link>https://lara.epfl.ch/w/compilation/local_higher-order_and_dispatched_procedures?rev=1228699748&amp;do=diff</link>
        <description>Local, Higher-Order, and Dispatched Procedures

Simple Local (Nested) Procedures

Nested functions can access outside functions.


def saveData(f : File) = {
  def wr(s : String) = {
    writeStringToFile(f, s)
  }
  def wrInt(x : Int) = {
    wr(integerToString(x))
  }
  wr(&quot;&lt;body&gt;&quot;)
  wr(&quot;This is my page.&quot;)
  wrInt(2008)
  wr(&quot;&lt;/body&gt;&quot;)
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lr_0_parser_actions?rev=1223234956&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T21:29:16+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lr_0_parser_actions</title>
        <link>https://lara.epfl.ch/w/compilation/lr_0_parser_actions?rev=1223234956&amp;do=diff</link>
        <description>LR(0) Parser Actions

Let K be parser state at the end of stack and t current token:

	*  if there is a transition  for  non-empty
		*  shift: push t onto stack
		*  if t is EOF, then accept

	*  reduce: if item  K then 
		*  pop p from stack (it will be there)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lr_1_parser_actions?rev=1223739788&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-11T17:43:08+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lr_1_parser_actions</title>
        <link>https://lara.epfl.ch/w/compilation/lr_1_parser_actions?rev=1223739788&amp;do=diff</link>
        <description>LR(1) Parser Actions

This is a natural generalization of SLR Parser Actions

Let K be parser state at the end of stack and t current token:

	*  if there is a transition  for  non-empty
		*  shift: push t onto stack 
		*  if t is EOF, then accept

	*  reduce: if item</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lr_parser_runs_automaton_over_stack?rev=1223229190&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T19:53:10+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lr_parser_runs_automaton_over_stack</title>
        <link>https://lara.epfl.ch/w/compilation/lr_parser_runs_automaton_over_stack?rev=1223229190&amp;do=diff</link>
        <description>LR Parser Runs Automaton over Stack

Key question in LR parsing

	*  when to shift
	*  when to reduce, and using which rule

Key property:

Stack contains a prefix of rightmost derivation consistent with the input so far

Next action should preserve this property if possible</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lr_parser_uses_rightmost_derivation?rev=1223226333&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T19:05:33+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lr_parser_uses_rightmost_derivation</title>
        <link>https://lara.epfl.ch/w/compilation/lr_parser_uses_rightmost_derivation?rev=1223226333&amp;do=diff</link>
        <description>LR Parser Uses Rightmost Derivation

In contrast, LR parser

	*  uses rightmost derivation
	*  accumulates right-hand side on stack
	*  then decides which production to use

We look at this rightmost derivation backwards, so:

	*  left-to-right parsing</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lr_parsing_tables?rev=1223240037&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T22:53:57+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lr_parsing_tables</title>
        <link>https://lara.epfl.ch/w/compilation/lr_parsing_tables?rev=1223240037&amp;do=diff</link>
        <description>LR Parsing Tables

So far we assumed that the state (set of items) is given by

	*  always starting in initial state
	*  re-running automaton on entire stack

Instead, LR parsers

	*  keep state corresponding to last run
	*  update the state on 'shift'</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/lr_parsing_with_lookahead_items?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:lr_parsing_with_lookahead_items</title>
        <link>https://lara.epfl.ch/w/compilation/lr_parsing_with_lookahead_items?rev=1429630495&amp;do=diff</link>
        <description>LR Parsing with Lookahead Items

Although SLR Parser Actions use lookahead, their finite state machine is computed without considering lookahead

LR(k) parser uses more general LR(k) items

We explain LR(1)

LR(1) item is (X::=p.q,a), written
X ::= p.q    a
where

	*</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/main.scala?rev=1222428161&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:22:41+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:main.scala</title>
        <link>https://lara.epfl.ch/w/compilation/main.scala?rev=1222428161&amp;do=diff</link>
        <description>package whilelang

/** For all programs listed in Programs; prints the code, interprets, simplifies, prints again and re-interprets. */
object Main {
  def main(args : Array[String]) : Unit = {
    Programs.programs.foreach(prog =&gt; {
      val (name, code) = prog
      println(&quot;*-*-*-*-*&quot;)
      println(&quot;Start of: &quot; + name)
      println
      TreePrinter(code)
      println
      Interpreter(code)
      
      val transformed: Statement = TreeSimplifier(code)
      println
      TreePrinter(tra…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/malloc_and_free?rev=1229279034&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-14T19:23:54+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:malloc_and_free</title>
        <link>https://lara.epfl.ch/w/compilation/malloc_and_free?rev=1229279034&amp;do=diff</link>
        <description>Malloc and Free

Some programming languages such as C it is programmer's responsibility to allocate and deallocate memory

We illustrate this by a model where

	*  ptr=malloc(N) allocates N words of memory and returns a memory address of location for this memory</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mallocfree.scala?rev=1229277214&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-14T18:53:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mallocfree.scala</title>
        <link>https://lara.epfl.ch/w/compilation/mallocfree.scala?rev=1229277214&amp;do=diff</link>
        <description>// Simple malloc and free, fragmentation possible
class Heap(size : Int) {
  private var mem = new Array[Int](size)   // OS would provide this memory
  private var nextAvailable : Int = 1 // where to allocate next

  val nextOffset = 0 // offset of 'next' field in free list
  val sizeOffset = 1 // offset of 'size' field in free list
  val minFreeListBlockSize = 2 // each free list block must have size at least 2 words

  // initially, free list contains one block whose size is memory size
  def …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mallocinfmem.scala?rev=1229277262&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-14T18:54:22+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mallocinfmem.scala</title>
        <link>https://lara.epfl.ch/w/compilation/mallocinfmem.scala?rev=1229277262&amp;do=diff</link>
        <description>// This is how to manage memory if it is infinite :)
class Heap(size : Int) {
  private var mem = new Array[Int](size)   // OS would provide this memory
  private var nextAvailable : Int = 0 // where to allocate next
  def malloc(blockSize : Int) : Int = {
    val res = nextAvailable
    nextAvailable = nextAvailable + blockSize
    initMem(res, nextAvailable) // optional
    res
  }

  def initMem(from : Int, to : Int) = {
    var i = from
    while (i &lt; to) { 
      mem(i) = 0;
      i = i + 1…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/manual_translation_into_bytecode?rev=1226684768&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-14T18:46:08+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:manual_translation_into_bytecode</title>
        <link>https://lara.epfl.ch/w/compilation/manual_translation_into_bytecode?rev=1226684768&amp;do=diff</link>
        <description>Translating If Expressions


int activityLevel
boolean action(int signals, boolean objects, int smart, int pretty) {
  if ((signals &gt; 5 || !objects) &amp;&amp; smart + 2*pretty &gt; 10) {
    activityLevel++;
    return true;
  } else {
    activityLevel--;
    return false;
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/maps_in_math?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:maps_in_math</title>
        <link>https://lara.epfl.ch/w/compilation/maps_in_math?rev=1429630495&amp;do=diff</link>
        <description>Maps in Math

Mathematical notion of map  is a partial function, that is, a function from a subset of  to .

	*  

	*  

We define 

Key operation is function update



If the value was defined before, now we redefine it.

A generalization of update is overriding one map by another:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mark_and_sweep_collector?rev=1229301723&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-15T01:42:03+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mark_and_sweep_collector</title>
        <link>https://lara.epfl.ch/w/compilation/mark_and_sweep_collector?rev=1229301723&amp;do=diff</link>
        <description>Mark and Sweep Garbage Collector

Idea:

	*  use free list, as in malloc+free, but do free automatically
	*  mark all reachable objects
	*  insert all unreachable objects into free list

How to determine reachable objects?

	*  start from the set of</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/memory_fragmentation?rev=1229288810&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-14T22:06:50+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:memory_fragmentation</title>
        <link>https://lara.epfl.ch/w/compilation/memory_fragmentation?rev=1229288810&amp;do=diff</link>
        <description>Memory Fragmentation

Suppose we have only 320 words of memory


x1 = alloc(32)
x2 = alloc(32)
...
x10 = alloc(32)
free(x1, 32)
free(x3, 32)
free(x5, 32)
free(x7, 32)
free(x9, 32)
// now have 160 bytes of free memory
z = alloc(50) // fails!


Some steps to address this:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/memory_layout_for_compiled_program?rev=1228691927&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-08T00:18:47+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:memory_layout_for_compiled_program</title>
        <link>https://lara.epfl.ch/w/compilation/memory_layout_for_compiled_program?rev=1228691927&amp;do=diff</link>
        <description>Memory Layout for Compiled Program
 Operating System    User Process Code      Machine Code      User Process Data    MaxBlock       Stack     :    \:/    ...    /:\    :     Dynamically Allocated Heap      Global Static Data (Const,Var)   0   
Both dynamically allocated heap and stack expand</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/method_calls?rev=1226227802&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-09T11:50:02+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:method_calls</title>
        <link>https://lara.epfl.ch/w/compilation/method_calls?rev=1226227802&amp;do=diff</link>
        <description>Method Calls

Relevant Instructions

Invoking methods:

	*  invokestatic
	*  invokevirtual

Returning value from methods:

	*  ireturn
	*  areturn
	*  return

Translation Rule for Calls</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/minijava?rev=1221839774&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-19T17:56:14+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:minijava</title>
        <link>https://lara.epfl.ch/w/compilation/minijava?rev=1221839774&amp;do=diff</link>
        <description>MiniJava

MiniJava is the toy language presented in the Tiger book. For the project, we will work on a slight extension to it, MiniJava+.

See description of MiniJava.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/minijava_compiler_project?rev=1222351374&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-25T16:02:54+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:minijava_compiler_project</title>
        <link>https://lara.epfl.ch/w/compilation/minijava_compiler_project?rev=1222351374&amp;do=diff</link>
        <description>MiniJava+ Compiler Project

The main project in this course consists in implementing minijavac, a compiler for a (very slightly) extended version of MiniJava, which we call MiniJava+. You will code all phases of a modern compiler, resulting in an implementation which will allow you to compile source files into Java Bytecode, in the same way</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/minijavaplus?rev=1225872842&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-05T09:14:02+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:minijavaplus</title>
        <link>https://lara.epfl.ch/w/compilation/minijavaplus?rev=1225872842&amp;do=diff</link>
        <description>MiniJava+ Resource Page

MiniJava+ is our extension to MiniJava, and is a strict subset of Java.

BNF

(reproduced and extended from here)
  Goal::=MainClass ( ClassDeclaration )* &lt;EOF&gt;    MainClass::=class Identifier { public static void main ( String [ ] Identifier</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/minijavaplustyperules?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:minijavaplustyperules</title>
        <link>https://lara.epfl.ch/w/compilation/minijavaplustyperules?rev=1429630495&amp;do=diff</link>
        <description>MiniJava+ Type Rules and Constraints

The type  is used for elements that need to be type-checked but do not carry a type themselves (this includes statements).

Class definitions and subtyping





















Class variables and methods</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mjp-binarysearch?rev=1222422914&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T11:55:14+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mjp-binarysearch</title>
        <link>https://lara.epfl.ch/w/compilation/mjp-binarysearch?rev=1222422914&amp;do=diff</link>
        <description>class BinarySearch{
    public static void main(String[] a){
	System.out.println(new BS().Start(20));
    }
}
// This class contains an array of integers and
// methods to initialize, print and search the array
// using Binary Search

class BS{
    int[] number ;
    int size ;

    // Invoke methods to initialize, print and search
    // for elements on the array
    public int Start(int sz){
	int aux01 ;
	int aux02 ;
	aux01 = this.Init(sz);
	aux02 = this.Print();
	if (this.Search(8)) System.ou…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mjp-binarytree?rev=1222428622&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:30:22+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mjp-binarytree</title>
        <link>https://lara.epfl.ch/w/compilation/mjp-binarytree?rev=1222428622&amp;do=diff</link>
        <description>class BinaryTree{
    public static void main(String[] a){
	System.out.println(new BT().Start());
    }
}


// This class invokes the methods to create a tree,
// insert, delete and serach for  elements on it
class BT {

    public int Start(){
	Tree root ;
	boolean ntb ;
	int nti ;

	root = new Tree();
	ntb = root.Init(16);
	ntb = root.Print();
	System.out.println(100000000);
	ntb = root.Insert(8) ;
	ntb = root.Print();
	ntb = root.Insert(24) ;
	ntb = root.Insert(4) ;
	ntb = root.Insert(12) ;
	…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mjp-bubblesort?rev=1222428345&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:25:45+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mjp-bubblesort</title>
        <link>https://lara.epfl.ch/w/compilation/mjp-bubblesort?rev=1222428345&amp;do=diff</link>
        <description>class BubbleSort{
    public static void main(String[] a){
	System.out.println(new BBS().Start(10));
    }
}


// This class contains the array of integers and
// methods to initialize, print and sort the array
// using Bublesort
class BBS{
    
    int[] number ;
    int size ;

    // Invoke the Initialization, Sort and Printing
    // Methods
    public int Start(int sz){
	int aux01 ;
	aux01 = this.Init(sz);
	aux01 = this.Print();
	System.out.println(99999);
	aux01 = this.Sort();
	aux01 = thi…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mjp-factorial?rev=1222422876&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T11:54:36+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mjp-factorial</title>
        <link>https://lara.epfl.ch/w/compilation/mjp-factorial?rev=1222422876&amp;do=diff</link>
        <description>class Factorial{
    public static void main(String[] a){
	System.out.println(new Fac().ComputeFac(10));
    }
}

class Fac {

    public int ComputeFac(int num){
	int num_aux ;
	if (num &lt; 1)
	    num_aux = 1 ;
	else 
	    num_aux = num * (this.ComputeFac(num-1)) ;
	return num_aux ;
    }

}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mjp-linearsearch?rev=1222428532&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:28:52+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mjp-linearsearch</title>
        <link>https://lara.epfl.ch/w/compilation/mjp-linearsearch?rev=1222428532&amp;do=diff</link>
        <description>class LinearSearch{
    public static void main(String[] a){
	System.out.println(new LS().Start(10));
    }
}


// This class contains an array of integers and
// methods to initialize, print and search the array
// using Linear Search
class LS {
    int[] number ;
    int size ;
    
    // Invoke methods to initialize, print and search
    // for elements on the array
    public int Start(int sz){
	int aux01 ;
	int aux02 ;

	aux01 = this.Init(sz);
	aux02 = this.Print();
	System.out.println(999…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mjp-linkedlist?rev=1222428575&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:29:35+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mjp-linkedlist</title>
        <link>https://lara.epfl.ch/w/compilation/mjp-linkedlist?rev=1222428575&amp;do=diff</link>
        <description>class LinkedList{
    public static void main(String[] a){
	System.out.println(new LL().Start());
    }
}

class Element {
    int Age ;          
    int Salary ;
    boolean Married ;

    // Initialize some class variables
    public boolean Init(int v_Age, int v_Salary, boolean v_Married){
	Age = v_Age ;
	Salary = v_Salary ;
	Married = v_Married ;
	return true ;
    }

    public int GetAge(){
	return Age ;
    }
    
    public int GetSalary(){
	return Salary ;
    }

    public boolean Get…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mjp-quicksort?rev=1222428491&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:28:11+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mjp-quicksort</title>
        <link>https://lara.epfl.ch/w/compilation/mjp-quicksort?rev=1222428491&amp;do=diff</link>
        <description>class QuickSort{
    public static void main(String[] a){
	System.out.println(new QS().Start(10));
    }
}


// This class contains the array of integers and
// methods to initialize, print and sort the array
// using Quicksort
class QS{
    
    int[] number ;
    int size ;

    // Invoke the Initialization, Sort and Printing
    // Methods
    public int Start(int sz){
	int aux01 ;
	aux01 = this.Init(sz);
	aux01 = this.Print();
	System.out.println(9999);
	aux01 = size - 1 ;
	aux01 = this.Sort…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/mjp-treevisitor?rev=1222428388&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:26:28+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:mjp-treevisitor</title>
        <link>https://lara.epfl.ch/w/compilation/mjp-treevisitor?rev=1222428388&amp;do=diff</link>
        <description>// The classes are basically the same as the BinaryTree 
// file except the visitor classes and the accept method
// in the Tree class

class TreeVisitor{
    public static void main(String[] a){
	System.out.println(new TV().Start());
    }
}

class TV {

    public int Start(){
	Tree root ;
	boolean ntb ;
	int nti ;
	MyVisitor v ;

	root = new Tree();
	ntb = root.Init(16);
	ntb = root.Print();
	System.out.println(100000000);
	ntb = root.Insert(8) ;
	ntb = root.Insert(24) ;
	ntb = root.Insert(4)…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/modifying_parser_to_construct_trees?rev=1223145823&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-04T20:43:43+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:modifying_parser_to_construct_trees</title>
        <link>https://lara.epfl.ch/w/compilation/modifying_parser_to_construct_trees?rev=1223145823&amp;do=diff</link>
        <description>Modifying a Parser to Construct Trees

Recall our WhileParser.scala

	*  each function returned unit (void) type

Now: each function

	*  extracts information from tokens
	*  obtains information from recursive calls
	*  returns a new tree.scala node

Result: ParserTrees.scala  (email me any errors you notice)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/multiway_branches?rev=1225675157&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T02:19:17+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:multiway_branches</title>
        <link>https://lara.epfl.ch/w/compilation/multiway_branches?rev=1225675157&amp;do=diff</link>
        <description>Multiway Branches

tableswitch

lookupswitch</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/note_on_polymorphism_and_subtyping?rev=1225057234&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-26T22:40:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:note_on_polymorphism_and_subtyping</title>
        <link>https://lara.epfl.ch/w/compilation/note_on_polymorphism_and_subtyping?rev=1225057234&amp;do=diff</link>
        <description>Note on Polymorphism and Subtyping

Programming languages such as Scala and (sufficiently recent versions of) Java combine parametric polymorphism with subtyping.

There are multiple solutions for how to design a language with these two features, but they are beyond this course</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/notion_of_hash-consing?rev=1223862621&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T03:50:21+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:notion_of_hash-consing</title>
        <link>https://lara.epfl.ch/w/compilation/notion_of_hash-consing?rev=1223862621&amp;do=diff</link>
        <description>Notion of Hash-Consing

Notion of not specific to compilers

	*  and need not be used in compilers

A generalization of idea of replacing strings with symbols

	*  ensure we can use pointer equality instead of structural equality
	*  avoid constructing duplicate objects that are equal</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/notion_of_subtyping?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:notion_of_subtyping</title>
        <link>https://lara.epfl.ch/w/compilation/notion_of_subtyping?rev=1429630495&amp;do=diff</link>
        <description>Notion of Subtyping

Subtypes as Subsets

In systems we have formally studied so far, each expression had exactly one type, such as 'int' or 'int -&gt; bool'

	*  this is not case any more in systems with subtyping

We can often think of a type  as approximating the set of values</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/notion_of_syntax_trees?rev=1223280057&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-06T10:00:57+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:notion_of_syntax_trees</title>
        <link>https://lara.epfl.ch/w/compilation/notion_of_syntax_trees?rev=1223280057&amp;do=diff</link>
        <description>Notion of Syntax Trees

We have seen how to build a parser

	*  complains if the input is wrong
	*  does absolutely nothing if input is correct :)

Next step: have parser create representation of the program

	*  this representation is abstract syntax tree</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/object_and_reference_manipulation?rev=1225675578&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-03T02:26:18+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:object_and_reference_manipulation</title>
        <link>https://lara.epfl.ch/w/compilation/object_and_reference_manipulation?rev=1225675578&amp;do=diff</link>
        <description>Object and Reference Manipulation

new

ifnull

ifnonnull

getfield

putfield</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/official_course_description?rev=1217239790&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-07-28T12:09:50+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:official_course_description</title>
        <link>https://lara.epfl.ch/w/compilation/official_course_description?rev=1217239790&amp;do=diff</link>
        <description>Official Course Description


The course aims to teach the fundamental aspects of analyzing computer languages and mapping them into executable form. At the end of the course, the student should
 - be able to define the formal syntax of computer languages,
 - be able to define the meaning of computer languages through interpreters,
 - know the internal structure and implementation of simple compilers
 - be able to write a compiler that maps a simple programming language into the code of a virtua…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/operational_semantics_of_lambda_with_letrec?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:operational_semantics_of_lambda_with_letrec</title>
        <link>https://lara.epfl.ch/w/compilation/operational_semantics_of_lambda_with_letrec?rev=1429630495&amp;do=diff</link>
        <description>Operational Semantics of Lambda Calculus with Letrec

We describe evaluation rules for our lambda calculus with letrec

We need such description to make rigorous proofs about compilers, including type systems

This is a mathematical description of an interpreter for this language</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/overview_of_an_optimizing_compiler?rev=1258927725&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-11-22T23:08:45+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:overview_of_an_optimizing_compiler</title>
        <link>https://lara.epfl.ch/w/compilation/overview_of_an_optimizing_compiler?rev=1258927725&amp;do=diff</link>
        <description>Overview of an Optimizing Compiler

source code


  int i = 0; /* some comment */
  int j = 0;
  while (i &lt; 10) {
    System.out.println(j);
    i = i + 1;
    j = j + 2*i+1;
  }

 Lexer 
list of tokens
INT, Identifier(&quot;i&quot;), EQUAL, IntNumeral(0), SEMICOLON, INT, Identifier(&quot;j&quot;), EQUAL, ...
WHILE, OPENPAREN, Identifier(&quot;i&quot;), LESSTHAN, IntNumeral(10), CLOSEDPAREN, OPENBRACE,
Identifier(&quot;System&quot;), DOT, Identifier(&quot;out&quot;), ...</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/overview_of_classfile_constant_pool?rev=1226283142&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T03:12:22+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:overview_of_classfile_constant_pool</title>
        <link>https://lara.epfl.ch/w/compilation/overview_of_classfile_constant_pool?rev=1226283142&amp;do=diff</link>
        <description>Overview of Classfile Constant Pool

Take abstract syntax tree for method type signatures and constants

	*  serialize it as a graph

To see it, use
javap -verbose
Cafebabe does most of these things for you

	*  can unzip Scala source code to see how</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/overview_of_compiling_to_stack_machine?rev=1225577271&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-01T23:07:51+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:overview_of_compiling_to_stack_machine</title>
        <link>https://lara.epfl.ch/w/compilation/overview_of_compiling_to_stack_machine?rev=1225577271&amp;do=diff</link>
        <description>Overview of Compiling to Stack Machine

Our goal in this lecture is to understand compilation from abstract syntax trees to stack machine code

Examples of this:

	*  javac
	*  your MiniJavaPlus compiler
	*  compiler from the Pascal Programming Language to pascal UCSD Pascal P-code machine

Source: Java (subset) abstract syntax tree</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/parse_trees_ambiguity_and_derivations?rev=1222202147&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-23T22:35:47+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:parse_trees_ambiguity_and_derivations</title>
        <link>https://lara.epfl.ch/w/compilation/parse_trees_ambiguity_and_derivations?rev=1222202147&amp;do=diff</link>
        <description>Parse Trees, Ambiguity, and Derivations

(Continuing from Limitations of Regular Expressions)

What is context-free grammar for balanced parantheses?


S ::= &quot;{&quot; &quot;}&quot; | &quot;{&quot; S &quot;}&quot; | S S
Example: deriving string
{{}} {} {{}{}}
Definitions:

	*  balanced = given by counting number of open parantheses so far</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/parsertrees.scala?rev=1223280326&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-06T10:05:26+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:parsertrees.scala</title>
        <link>https://lara.epfl.ch/w/compilation/parsertrees.scala?rev=1223280326&amp;do=diff</link>
        <description>Parser for While that Generates Trees


/* A very simple version of while language:

program ::= statements EOF
statements = statement*
statement ::= print | assign | while | block
write ::= &quot;println&quot; &quot;(&quot; var &quot;)&quot; &quot;;&quot;
assign ::= var &quot;=&quot; expr &quot;;&quot;
while ::= &quot;while&quot; &quot;(&quot; expr &quot;)&quot; statement
block ::= &quot;{&quot; statements &quot;}&quot;
expr ::= expr &quot;+&quot; expr | expr &quot;-&quot; expr | expr &quot;*&quot; expr | 
         &quot;(&quot; expr &quot;)&quot; | var | intconst 
*/

class Parser(lex : Lexer) {
  // program ::= statement* EOF
  def parseProgram : Li…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/parsingtechniques?rev=1223738747&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-11T17:25:47+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:parsingtechniques</title>
        <link>https://lara.epfl.ch/w/compilation/parsingtechniques?rev=1223738747&amp;do=diff</link>
        <description>Parsing Techniques - A Practical Guide

Dick Grune and Ceriel J.H. Jacobs: Parsing Techniques - A Practical Guide

	*  Book Web Page</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/phases_of_a_compiler?rev=1228589086&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-06T19:44:46+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:phases_of_a_compiler</title>
        <link>https://lara.epfl.ch/w/compilation/phases_of_a_compiler?rev=1228589086&amp;do=diff</link>
        <description>Selected Phases of a Compiler

source code


  int i = 0; /* some comment */
  int j = 0;
  while (i &lt; 10) {
    System.out.println(j);
    i = i + 1;
    j = j + 2*i+1;
  }

 Lexer 
list of tokens
INT, Identifier(&quot;i&quot;), EQUAL, IntNumeral(0), SEMICOLON, INT, Identifier(&quot;j&quot;), EQUAL, ...
WHILE, OPENPAREN, Identifier(&quot;i&quot;), LESSTHAN, IntNumeral(10), CLOSEDPAREN, OPENBRACE,
Identifier(&quot;System&quot;), DOT, Identifier(&quot;out&quot;), ...</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/pointer_reversal?rev=1229295048&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-14T23:50:48+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:pointer_reversal</title>
        <link>https://lara.epfl.ch/w/compilation/pointer_reversal?rev=1229295048&amp;do=diff</link>
        <description>Pointer Reversal

Suppose we write depth-first search in mark and sweep using a stack

What is the maximal stack size?

	*  stack of the programming language
	*  explicit stack
	*  pointer reversal: store information within nodes

Explicit Stack


function DFS(x)
  if (x is a pointer and record x is not marked) {
    mark(x)
    t = 1
    stack(t) = x
    while (t &gt; 0) {
      x = stack(t)
      t = t - 1
      for each field f_i of record x
        if (x.f_i is a pointer and x.f_i is not marked…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/polynomials.pscala?rev=1222612001&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-28T16:26:41+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:polynomials.pscala</title>
        <link>https://lara.epfl.ch/w/compilation/polynomials.pscala?rev=1222612001&amp;do=diff</link>
        <description>// polynomial ::= term (&quot;+&quot; term)*
def parsePolynomial = {
  parseTerm
  while (lex.current==PLUS) {
    lex.next
    parseTerm
  }
}
// term ::= factor (&quot;*&quot; factor)*
def parseTerm = {
  parseFactor
  while (lex.current==MUL) {
    lex.next
    parseFactor
  }
}
// factor ::= constant | variable | &quot;(&quot; polynomial &quot;)&quot;
def parseFactor = {
  if (lex.current==CONST)
    lex.next
  else if (lex.current==IDENT)
    lex.next
  else if (lex.current==OPAREN) {
    lex.next
    parsePolynomial
    eat(CPAR…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/polynomialsll.grammar?rev=1222599420&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-28T12:57:00+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:polynomialsll.grammar</title>
        <link>https://lara.epfl.ch/w/compilation/polynomialsll.grammar?rev=1222599420&amp;do=diff</link>
        <description>polynomial ::= term (&quot;+&quot; term)*
  term ::= factor (&quot;*&quot; factor)*
  factor ::= constant | variable | &quot;(&quot; polynomial &quot;)&quot;</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/polytokens.jj?rev=1221153954&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-11T19:25:54+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:polytokens.jj</title>
        <link>https://lara.epfl.ch/w/compilation/polytokens.jj?rev=1221153954&amp;do=diff</link>
        <description>options {
  JAVA_UNICODE_ESCAPE = true;
}

PARSER_BEGIN(Polynomials)
  public class Polynomials {}
PARSER_END(Polynomials)


// Insert a specification of a lexical analysis here. 

TOKEN: {
    &lt;IDENTIFIER: &lt;LETTER&gt; (&lt;LETTER&gt; | &lt;DIGIT&gt; | &quot;_&quot;)* &gt;
  | &lt;CONSTANT: &lt;DIGIT&gt; (&lt;DIGIT&gt;)* &gt;
  | &lt;LETTER: [&quot;a&quot;-&quot;z&quot;] | [&quot;A&quot;-&quot;Z&quot;]&gt;
  | &lt;DIGIT: [&quot;0&quot;-&quot;9&quot;]&gt;
}

SKIP: {
   &quot; &quot;
 | &quot;\n&quot;
 | &quot;\t&quot;
}

// The following is a simple grammar that will allow you
// to test the generated lexer.

void Goal():
{}
{
  ( MyToken() …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/polytokentest.java?rev=1221154024&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-11T19:27:04+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:polytokentest.java</title>
        <link>https://lara.epfl.ch/w/compilation/polytokentest.java?rev=1221154024&amp;do=diff</link>
        <description>public class PolyTokenTest {  
   public static void main(String [] args) {
      try {
         new Polynomials(System.in).Goal();
         System.out.println(&quot;Lexical analysis successfull&quot;);
      }
      catch (ParseException e) {
         System.out.println(&quot;Lexer Error : \n&quot;+ e.toString());
      }
   }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/postfix_translation_of_boolean_operators?rev=1226275427&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T01:03:47+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:postfix_translation_of_boolean_operators</title>
        <link>https://lara.epfl.ch/w/compilation/postfix_translation_of_boolean_operators?rev=1226275427&amp;do=diff</link>
        <description>Postfix Translation of Boolean Operators

Eager Boolean Operations

Candidate translation, knowing that booleans are 0 or 1:


[[ e1 &amp; e2 ]] =
   [[ e1 ]]
   [[ e2 ]]
   iand



[[ e1 | e2 ]] =
   [[ e1 ]]
   [[ e2 ]]
   ior


This indeed works for &amp;, |</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/precedence_in_lr_parsing?rev=1223242302&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T23:31:42+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:precedence_in_lr_parsing</title>
        <link>https://lara.epfl.ch/w/compilation/precedence_in_lr_parsing?rev=1223242302&amp;do=diff</link>
        <description>Precedence in LR Parsing

Using LR parser we can even parse certain ambigous grammars

There is an automaton for every grammar, but it may have shift/reduce conflicts

For ambigous grammars, even LR(1) automaton will generate conflicts

Example: grammar like</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/prefix_infix_postfix_notation?rev=1225646798&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-02T18:26:38+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:prefix_infix_postfix_notation</title>
        <link>https://lara.epfl.ch/w/compilation/prefix_infix_postfix_notation?rev=1225646798&amp;do=diff</link>
        <description>Prefix, Infix, and Postfix Notation

Let

	*   be a binary operation and 
	*  ,  two expressions

We can write  in
 prefix notation    infix notation     postfix notation   
Infix is the worst notation: it requires parantheses and parenthese, the other two do not!</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/printing_prefix_infix_postfix?rev=1225645454&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-02T18:04:14+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:printing_prefix_infix_postfix</title>
        <link>https://lara.epfl.ch/w/compilation/printing_prefix_infix_postfix?rev=1225645454&amp;do=diff</link>
        <description>Printing Prefix Infix Postfix

Recall tree.scala for the while language

	*  it contained pretty-printer for infix expressions

Pretty printer for prefix, infix, and postfix expressions:


sealed abstract class Expr
case class Var(varID: String) extends Expr
case class IntLiteral(value: Int) extends Expr
case class Plus(lhs: Expr, rhs: Expr) extends Expr
case class Times(lhs: Expr, rhs: Expr) extends Expr

sealed abstract class Token
case class ID(str : String) extends Token
case class Const(c :…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/programs.scala?rev=1222428130&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:22:10+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:programs.scala</title>
        <link>https://lara.epfl.ch/w/compilation/programs.scala?rev=1222428130&amp;do=diff</link>
        <description>package whilelang;

object Programs {
  /** A program consists of a name and the main statement. */
  type Program = Pair[String,Statement]
  
  /** Does nothing. */
  val skip: Program = (&quot;Skip&quot;, Skip)
  
  /** Prints out n^2 for n = 1...10. */
  val squares: Program = (&quot;Squares&quot;, Block(
      Assign(&quot;i&quot;, IntLiteral(0)) ::
      Assign(&quot;j&quot;, IntLiteral(1)) ::
      While(LessThan(Var(&quot;i&quot;), IntLiteral(10)), Block(
          Print(&quot;&quot;, &quot;j&quot;) ::
          Assign(&quot;i&quot;, Plus(Var(&quot;i&quot;), IntLiteral(1))) ::…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/proving_safety_properties_using_types?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:proving_safety_properties_using_types</title>
        <link>https://lara.epfl.ch/w/compilation/proving_safety_properties_using_types?rev=1429630495&amp;do=diff</link>
        <description>Proving Safety Properties using Types

We next discuss general techniques for proving absence of errors in programs

This also tells us how to prove that our type systems are meaningul (sound)

Safety Properties of Programs

Given a one-step reduction relation</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/pushdown_automata?rev=1223132484&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-04T17:01:24+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:pushdown_automata</title>
        <link>https://lara.epfl.ch/w/compilation/pushdown_automata?rev=1223132484&amp;do=diff</link>
        <description>Pushdown Automata in Parsing

Why pushdown automata

	*  pushdown automata are like finite automata, but also work with stack
	*  parsing requires stack

Equivalence of expressive power:
 regular expressions  non-deterministic FA  context-free grammars</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/quiz?rev=1229338338&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-15T11:52:18+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:quiz</title>
        <link>https://lara.epfl.ch/w/compilation/quiz?rev=1229338338&amp;do=diff</link>
        <description>Quiz

Quiz is in room INM 202 where we usually have exercises.

Review labs, homeworks, and lectures to prepare.

Please arrive by 8:05am

	*  bring EPFL id

You may bring any printed material (e.g. Tiger book, lectures, your homeworks, printouts of your labs).</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/race?rev=1228315049&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-03T15:37:29+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:race</title>
        <link>https://lara.epfl.ch/w/compilation/race?rev=1228315049&amp;do=diff</link>
        <description>The MiniJava+ Compiler Race

To celebrate the completion of the first basic version of your MiniJava+ compilers, we are organizing a competition.

We will test all your compilers for correctness against a series of tests (some of which should pass, while others should fail). The tests will cover all phases of your compiler, not only code generation (although the correctness of the execution will be the criterion for all passing examples). In separate tracks, we will measure the size of the gener…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/range_analysis?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:range_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/range_analysis?rev=1429630495&amp;do=diff</link>
        <description>Range Analysis

Properties of Interest

A more precise analysis that computes sets to which integer variables belong

	*  still no relations between variables - independent attribute analysis

For each program point compute interval (or a union of intervals) to which variable belongs</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/rangeanalysislattice.scala?rev=1227653712&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-25T23:55:12+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:rangeanalysislattice.scala</title>
        <link>https://lara.epfl.ch/w/compilation/rangeanalysislattice.scala?rev=1227653712&amp;do=diff</link>
        <description>object RangeLattice extends Lattice {
  sealed abstract class Range
  case object Empty extends Range // {}
  case class Bounded(a : Int, b : Int) extends Range // [a,b]
  { assert (a &lt;= b) }
  case class LeftUnbounded(b : Int) extends Range // (-inf,b]
  case class RightUnbounded(a : Int) extends Range // [a,+inf)
  case object Full extends Range // (-inf,+inf)

  type Elem = Range
  def leq(x : Range, y : Range) = (x,y) match {
    case (Empty,_) =&gt; true
    case (_,Full) =&gt; true
    case (Bou…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/recursive_descent_parsing?rev=1223128805&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-04T16:00:05+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:recursive_descent_parsing</title>
        <link>https://lara.epfl.ch/w/compilation/recursive_descent_parsing?rev=1223128805&amp;do=diff</link>
        <description>Recursive Descent (Predictive) Parsing

Recursive descent is a decent parsing technique.
 descent:    a movement downward  decent:    adequate: sufficient for the purpose; “an adequate income”; “the food was adequate”; “a decent wage”; “</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/reference_counting?rev=1229290905&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-14T22:41:45+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:reference_counting</title>
        <link>https://lara.epfl.ch/w/compilation/reference_counting?rev=1229290905&amp;do=diff</link>
        <description>Reference Counting

In each memory location store the number of incoming pointers

Free the block if the counter is zero

What is the block has pointers itsefl?

	*  decrementing counts when the r is reused again
	*  ensures a bounded amount of work for each operation</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/register_allocation_using_liveness_information?rev=1228736559&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-08T12:42:39+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:register_allocation_using_liveness_information</title>
        <link>https://lara.epfl.ch/w/compilation/register_allocation_using_liveness_information?rev=1228736559&amp;do=diff</link>
        <description>Register Allocation using Liveness Information


static int x;
static int y;
static int z;
static int res;
 
int f() {
  int xy;
  int yz;
  int xz; 
  int res1; 
  xy = x * y;
  yz = y * z;
  xz = x * z;
  res1 = xy + yz;
  res = res1 + xz;
}


How to generate code that we saw in</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/register_machine_in_scala?rev=1258932956&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-11-23T00:35:56+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:register_machine_in_scala</title>
        <link>https://lara.epfl.ch/w/compilation/register_machine_in_scala?rev=1258932956&amp;do=diff</link>
        <description>Register Machine in Scala


sealed abstract class Value
  case class Immediate(const : Int) extends Value

  sealed abstract class Address extends Value
    case class Register(r : Int) extends Address
    case class Memory(a : Int) extends Address
    case class Indirect(r : Int) extends Address
    case class IndirectOffset(r : Int, offset : Int) extends Address

sealed abstract class ArithOp
  case object Mul extends ArithOp
  case object Add extends ArithOp
  case object Sub extends ArithOp
…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/reporting_errors_based_on_syntax_tree?rev=1223876237&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T07:37:17+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:reporting_errors_based_on_syntax_tree</title>
        <link>https://lara.epfl.ch/w/compilation/reporting_errors_based_on_syntax_tree?rev=1223876237&amp;do=diff</link>
        <description>Reporting Errors Based on Syntax Tree

Suppose we discover undclared variable 'i' in syntax tree

	*  in a program of 100K lines

What error message would you like compiler to give?

	*  An ocurrence of variable 'i' not declared
	*  An ocurrence of variable 'i'</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/resolving_variable_names?rev=1223862847&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T03:54:07+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:resolving_variable_names</title>
        <link>https://lara.epfl.ch/w/compilation/resolving_variable_names?rev=1223862847&amp;do=diff</link>
        <description>Resolving Variables

Recall Semantic Analysis as Simplified Interpretation

Even if we associate unique symbols with identifiers,

	*  same identifier can denote different variables at different points

This is why symbol table needs to change depending on position in tree

Once we look up identifier, we can directly link it to its definition</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/scalabestpractice?rev=1227089061&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-19T11:04:21+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:scalabestpractice</title>
        <link>https://lara.epfl.ch/w/compilation/scalabestpractice?rev=1227089061&amp;do=diff</link>
        <description>Scala Best Practice

Printing lists is easy

When pretty-printing an AST or simply debugging, avoid the following (albeit functional, unnecessarily long) code:


printList(listOfThings)

def printList(lst: List[A]): Unit = {
  def printList0(lst: List[A]): Unit = lst match {
    case x1 :: x2 :: Nil =&gt; print(x1 + &quot;, &quot;); printList0(lst.tail)
    case x1 :: Nil =&gt; print(x1)
    case Nil =&gt; ;
  }

  print(&quot;(&quot;)
  printList0(lst)
  print(&quot;)&quot;)
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/semantic_analysis_as_simplified_interpretation?rev=1224249045&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-17T15:10:45+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:semantic_analysis_as_simplified_interpretation</title>
        <link>https://lara.epfl.ch/w/compilation/semantic_analysis_as_simplified_interpretation?rev=1224249045&amp;do=diff</link>
        <description>Semantic Analysis as Simplified Interpretation

Goal: detect whether there will be errors in any execution

Starting point: our interpreter from Handling Scopes in Interpreters


/* What did we do compared to interpreter:
    - erased concrete values in IntValue, BoolValue
    - erased the use of concrete values in evalExpr, checkType
    - checking types and initialization earlier: for every getVar
    - handling of if statements
    - procedure calls: 
        - check parameters at call (in in…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/short-circuit_evaluation?rev=1226277494&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T01:38:14+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:short-circuit_evaluation</title>
        <link>https://lara.epfl.ch/w/compilation/short-circuit_evaluation?rev=1226277494&amp;do=diff</link>
        <description>Short-Circuit Evaluation

For correct semantics, we express &amp;&amp;,|| using ?: operator:

x &amp;&amp; y ===  x ? y : false ++

x || y ===  x ? true : y ++

Resulting translation:


[[ x &amp;&amp; y ]] =
        [[ x ]]
        ifeq nFalse
        [[ y ]]
        goto nAfter
nFalse: iconst_0
nAfter:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/sign_analysis?rev=1226886485&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-17T02:48:05+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:sign_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/sign_analysis?rev=1226886485&amp;do=diff</link>
        <description>Sign Analysis

Determine whether each variable is guaranteed to be negative, zero, or stringly positive

Lattice of possibilities and its meaning

Example of analyzing simple loop</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/signanalysis.scala?rev=1258916813&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-11-22T20:06:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:signanalysis.scala</title>
        <link>https://lara.epfl.ch/w/compilation/signanalysis.scala?rev=1258916813&amp;do=diff</link>
        <description>object Signs {

  // A 5-element abstraction of sets of integers
  sealed abstract class Sign
  case object TopSign extends Sign    // all integers
  case object BottomSign extends Sign // {}
  case object Positive extends Sign   // {1,2,3,...}
  case object Zero extends Sign       // {0}
  case object Negative extends Sign   // {...,-3,-2,-1}

  class SignLattice extends Lattice { // Sign as a lattice
    type Elem = Sign
    val top = TopSign        // universal set is top
    val bottom = Bot…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/simple_types_for_lambda_calculus?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:simple_types_for_lambda_calculus</title>
        <link>https://lara.epfl.ch/w/compilation/simple_types_for_lambda_calculus?rev=1429630495&amp;do=diff</link>
        <description>Simple Types for Lambda Calculus

There are several type systems for lambda calculus

We consider here the simplest one

	*  types are disjoint
	*  only primitive and function types
	*  every lambda binding specifies its type

Type Rules for Simply Typed Lambda Calculus</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/simpleast.scala?rev=1227491354&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-24T02:49:14+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:simpleast.scala</title>
        <link>https://lara.epfl.ch/w/compilation/simpleast.scala?rev=1227491354&amp;do=diff</link>
        <description>/* Syntax tree for a toy language */

object SimpleAST {
  type Ident = String

  sealed abstract class Statement
  case class AssignStat(lhs : Ident, rhs : Expression) extends Statement
  case class PrintStat(e : Expression) extends Statement
  case class IfStat(cond : Expression, 
		    trueS : Statement,
		    falseS : Statement) extends Statement
  case class WhileStat(cond : Expression, 
		       body : Statement) extends Statement
  case class BlockStat(sts : List[Statement]) extends State…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/simplecfg.scala?rev=1227491333&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-24T02:48:53+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:simplecfg.scala</title>
        <link>https://lara.epfl.ch/w/compilation/simplecfg.scala?rev=1227491333&amp;do=diff</link>
        <description>object SimpleCFG {
  type Variable = String // for simplicity

  sealed abstract class SimpleValue
  case class VarValue(v : Variable) extends SimpleValue {
    override def toString = v
  }
  case class Const(c : Int) extends SimpleValue {
    override def toString = { &quot;&quot; + c }
  }

  sealed abstract class Operation
  sealed case class ArithOp extends Operation
  case object PlusOp extends ArithOp {
    override def toString = &quot;+&quot;
  }
  abstract case class RelOp extends Operation 
  case object…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/simpletranslate.scala?rev=1227491380&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-24T02:49:40+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:simpletranslate.scala</title>
        <link>https://lara.epfl.ch/w/compilation/simpletranslate.scala?rev=1227491380&amp;do=diff</link>
        <description>import SimpleCFG._, SimpleAST._
final class ASTtoCFG(cfg : Cfg) {

  private type Vertex = cfg.Vertex

  private val TrueConst = 1
  private val FalseConst = 0

  object FreshName { 
    var counter : Int = 0
    def get : String = {
      counter = counter + 1
      &quot;x&quot; + counter
    }
  }

  object Emit {
    private var pc : Vertex = cfg.entry
    def getPC : Vertex = { pc }
    def setPC(v : Vertex) = { pc = v }
    def statementBetween(v1 : Vertex, s : CfgStmt, v2 : Vertex) = {
      cfg +=…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/simply_typed_lambda_calculus?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:simply_typed_lambda_calculus</title>
        <link>https://lara.epfl.ch/w/compilation/simply_typed_lambda_calculus?rev=1429630495&amp;do=diff</link>
        <description>Simply Typed Lambda Calculus

Lambda calculus is a simple and powerful notation for defining functions.  Among its uses are

	*  foundation of programming languages, especially functional languages such as Ocaml, Haskell, and Scala
	*  basis of higher order logic</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/slr_parser_actions?rev=1223239860&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-05T22:51:00+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:slr_parser_actions</title>
        <link>https://lara.epfl.ch/w/compilation/slr_parser_actions?rev=1223239860&amp;do=diff</link>
        <description>SLR Parser Actions

SLR (simple LR) is like LR(0) but reduces on (X::=p.) only if additionally:

	*  t  follow(X) where  is current token

Otherwise, same as LR(0) Parser Actions

Let K be parser state at the end of stack and t current token:

	*  if there is a transition</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/solution?rev=1223452364&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-08T09:52:44+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:solution</title>
        <link>https://lara.epfl.ch/w/compilation/solution?rev=1223452364&amp;do=diff</link>
        <description>options {
    STATIC = false;
//    LOOKAHEAD = 2;
}
PARSER_BEGIN(WhileParser)
    class WhileParser {
        public static void main(String[] args) throws ParseException, TokenMgrError {
            WhileParser parser = new WhileParser(System.in);
            parser.Start();
        }
    }
PARSER_END(WhileParser)

SKIP : { &quot; &quot; | &quot;\t&quot; | &quot;\n&quot; | &quot;\r&quot; | &lt; &quot;//&quot;(~[&quot;\n&quot;, &quot;\r&quot;])* (&quot;\n&quot; | &quot;\r&quot; | &quot;\r\n&quot;)&gt; }
TOKEN : { &lt; INTLIT: &quot;0&quot; | [&quot;1&quot;-&quot;9&quot;]([&quot;0&quot;-&quot;9&quot;])* &gt; }
TOKEN : { &lt; STRLIT: &quot;\&quot;&quot; (~[&quot;\&quot;&quot;, &quot;\n&quot;, &quot;\r&quot;…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/squares.while?rev=1221171716&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-12T00:21:56+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:squares.while</title>
        <link>https://lara.epfl.ch/w/compilation/squares.while?rev=1221171716&amp;do=diff</link>
        <description>// Prints n^2 for n=1...10
i = 0;
j = 1;
while (i &lt; 10) {
  println(&quot;&quot;, j);
  i = i + 1; // increment counter
  j = j + 2*i+1;
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/stack_frames_and_procedure_calls?rev=1228694501&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-08T01:01:41+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:stack_frames_and_procedure_calls</title>
        <link>https://lara.epfl.ch/w/compilation/stack_frames_and_procedure_calls?rev=1228694501&amp;do=diff</link>
        <description>Stack Frames and Procedure Calls

Stack Frames

To compile procedures, we organize stack into stack frames (activation records)

Each procedure call allocates new stack frame on the stack

When procedure returns, the stack frame is deallocated

This allows us to support recursive procedure calls</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/subtyping_for_assignments?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:subtyping_for_assignments</title>
        <link>https://lara.epfl.ch/w/compilation/subtyping_for_assignments?rev=1429630495&amp;do=diff</link>
        <description>Subtyping for Assignments

Named Variables

If a mutable variable named  has type , it means that it is guaranteed to be able to store values in 

We cannot pretend that  can store values of supertype  because if we later read a value, we can unexpectedly get value that is not in</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/subtyping_for_functions?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:subtyping_for_functions</title>
        <link>https://lara.epfl.ch/w/compilation/subtyping_for_functions?rev=1429630495&amp;do=diff</link>
        <description>Subtyping for Functions

To obtain lambda calculus with subtyping, we modify only primitive rules if needed and the application rule for Simple Types for Lambda Calculus.

We modify application rule to allow not only arguments of exact type, but also of subtype:



This modification alone allows us to write e.g.</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/subtyping_rules?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:subtyping_rules</title>
        <link>https://lara.epfl.ch/w/compilation/subtyping_rules?rev=1429630495&amp;do=diff</link>
        <description>Subtyping Rules

Subtype relation C&lt;:D iff there is a chain of subclass relations from D (the super class) to C (the subclass)

How do we modify subtyping rules for

	*  assignments
	*  method calls

Assignment



Method calls:



Method definitions:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/symbol_table_contents?rev=1223876515&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T07:41:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:symbol_table_contents</title>
        <link>https://lara.epfl.ch/w/compilation/symbol_table_contents?rev=1223876515&amp;do=diff</link>
        <description>Symbol Table Contents

What should be in a symbol table?

All information is derived from syntax tree

	*  symbol table is interconnected with syntax tree
	*  in old one-pass compilers there was only symbol table
	*  today it gives faster, easier access to parts of syntax tree</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/termination_of_data-flow_analysis?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:termination_of_data-flow_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/termination_of_data-flow_analysis?rev=1429630495&amp;do=diff</link>
        <description>Termination and Efficiency of Data-Flow Analysis

Definition: A chain of length  is a sequence  such that



where  means, as usual, 

Definition: A lattice has a finite height  if it has a chain of length  and every chain is of length at most .

A finite lattice is of finite height</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/test.jvm?rev=1220862454&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-08T10:27:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:test.jvm</title>
        <link>https://lara.epfl.ch/w/compilation/test.jvm?rev=1220862454&amp;do=diff</link>
        <description>Compiled from &quot;test.java&quot;
class Test extends java.lang.Object{
Test();
  Code:
   0:   aload_0
   1:   invokespecial   #1; //Method java/lang/Object.&quot;&lt;init&gt;&quot;:()V
   4:   return

public static void main(java.lang.String[]);
  Code:
   0:   iconst_0
   1:   istore_1
   2:   iconst_0
   3:   istore_2
   4:   iload_1
   5:   bipush  10
   7:   if_icmpge       32
   10:  getstatic       #2; //Field java/lang/System.out:Ljava/io/PrintStream;
   13:  iload_2
   14:  invokevirtual   #3; //Method java/io…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/test.s?rev=1220803439&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-07T18:03:59+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:test.s</title>
        <link>https://lara.epfl.ch/w/compilation/test.s?rev=1220803439&amp;do=diff</link>
        <description>.file   &quot;test.c&quot;
        .section        .rodata
.LC0:
        .string &quot;%d\n&quot;
        .text
.globl main
        .type   main, @function
main:
        leal    4(%esp), %ecx
        andl    $-16, %esp
        pushl   -4(%ecx)
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ecx
        subl    $36, %esp
        movl    $0, -12(%ebp)
        movl    $0, -8(%ebp)
        jmp     .L2
.L3:
        movl    -8(%ebp), %eax
        movl    %eax, 4(%esp)
        movl    $.LC0, (%esp)
      …</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/testpolyinput.poly?rev=1221154097&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-11T19:28:17+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:testpolyinput.poly</title>
        <link>https://lara.epfl.ch/w/compilation/testpolyinput.poly?rev=1221154097&amp;do=diff</link>
        <description>x + 3 * y0 * (zLongIdentifier * ! 12)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/tiger_book?rev=1220966083&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-09T15:14:43+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:tiger_book</title>
        <link>https://lara.epfl.ch/w/compilation/tiger_book?rev=1220966083&amp;do=diff</link>
        <description>Textbook

	*  Modern Compiler Implementation in Java (2nd Edition):
			*  Andrew Appel's web site
			*  2nd Edition from Cambridge University Press
			*  2nd Edition from Amazon.com
			*  2nd Edition from Amazon.de

	*  Textbook materials
			*  from Andrew Appel
			*  from Cambridge University Press
			*  from Jens Palsberg's course</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/tokens.scala?rev=1221220304&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-12T13:51:44+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:tokens.scala</title>
        <link>https://lara.epfl.ch/w/compilation/tokens.scala?rev=1221220304&amp;do=diff</link>
        <description>sealed abstract class Token
case class ID(content : String) extends Token
case class IntConst(value : Int) extends Token
case object AssignEQ extends Token
case object CompareEQ extends Token
case object MOD extends Token
case object DIV extends Token
case object MUL extends Token
case object PLUS extends Token
case object MINUS extends Token
case object LEQ extends Token
case object LESS extends Token
case object OPAREN extends Token
case object CPAREN extends Token
case object WHILE extends To…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/tokens_words_of_while_language?rev=1221224583&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-12T15:03:03+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:tokens_words_of_while_language</title>
        <link>https://lara.epfl.ch/w/compilation/tokens_words_of_while_language?rev=1221224583&amp;do=diff</link>
        <description>Tokens (Words) of While Language

token = word (in a general sense)

What are the tokens in squares.while example?


// Prints n^2 for n=1...10
i = 0;
j = 1;
while (i &lt; 10) {
  println(&quot;&quot;, j);
  i = i + 1; // increment counter
  j = j + 2*i+1;
}


Several token types</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/tools_for_constructing_lexers?rev=1221927116&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-20T18:11:56+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:tools_for_constructing_lexers</title>
        <link>https://lara.epfl.ch/w/compilation/tools_for_constructing_lexers?rev=1221927116&amp;do=diff</link>
        <description>Tools for Constructing Lexers

We can use JavaCC file to generate lexers.

Files:

	*  simple lexer for polynomials: polyTokens.jj
	*  simple main file: PolyTokenTest.java
	*  simple test input for lexer: TestPolyInput.poly

Instructions:
javacc polyTokens.jj
javac *.java
java -cp . PolyTokenTest &lt; TestPolyInput.poly</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/top?rev=1230980085&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-01-03T11:54:45+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:top</title>
        <link>https://lara.epfl.ch/w/compilation/top?rev=1230980085&amp;do=diff</link>
        <description>Compiler Construction 2008

Course Information

Moodle Page for Uploading Your Solutions

MiniJava+

Competition results

The winners of the 2008 competition are, ex-aequo:

	*  Group 02 - Daniel Chappuis &amp; Stéphane Testuz
	*  Group 13 - Thibaut Beuret &amp; Pierre-François Laquerre

...whose compilers passed the 185 benchmarks without any single problem, congratulations!</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/transforming_to_chomsky_normal_form?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:transforming_to_chomsky_normal_form</title>
        <link>https://lara.epfl.ch/w/compilation/transforming_to_chomsky_normal_form?rev=1429630495&amp;do=diff</link>
        <description>Transforming a Grammar to Chomsky Form

We show how to make a grammar:

	*  without unproductive symbols
	*  without unreachable symbols
	*  -free (no non-start nullable symbols)
	*  without single productions X::=Y (X,Y non-terminals)
	*  without productions of arity more than two</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/translating_expressions_to_stack_machine?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:translating_expressions_to_stack_machine</title>
        <link>https://lara.epfl.ch/w/compilation/translating_expressions_to_stack_machine?rev=1429630495&amp;do=diff</link>
        <description>Translating Expressions to Stack Machine

Connection to Postfix

Example: translate expression
(a*b + b*c + a*c) * 2
into posftix form.

Tree:




        * 
     +     2
  *     +
 a b  *   *
     b c a c


Postfix expression:


a b * b c * + a c * + 2 *</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/translating_expressions_to_stack_machine_code?rev=1225020176&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-26T12:22:56+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:translating_expressions_to_stack_machine_code</title>
        <link>https://lara.epfl.ch/w/compilation/translating_expressions_to_stack_machine_code?rev=1225020176&amp;do=diff</link>
        <description>Translating Expressions to Stack Machine Code

Stack machine containing integers

Generating code by postfix traversal of the tree

Correctness proof of the translation</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/translating_syntax_tree_to_cfg?rev=1226887933&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-17T03:12:13+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:translating_syntax_tree_to_cfg</title>
        <link>https://lara.epfl.ch/w/compilation/translating_syntax_tree_to_cfg?rev=1226887933&amp;do=diff</link>
        <description>Translating Syntax Tree to CFG

Similar to

	*  fresh variable names instead of stack for expressions
	*  edges in CFG instead of jump instructions
	*  test edges to encode conditional branches

Example of translation

Building a Translator to CFG

Simulating</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/translation_correctness_for_expressions?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:translation_correctness_for_expressions</title>
        <link>https://lara.epfl.ch/w/compilation/translation_correctness_for_expressions?rev=1429630495&amp;do=diff</link>
        <description>Translation Correctness for Expressions

Recall Evaluating Postfix

Notation

Functions:

	*  
	*  
	*  

For simplicity we will omit environments mapping variables

	*  does not affect this proof 

We often write X instead of List(X) when X is one element

Also, we often use same symbol '*' for</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/translation_of_relations?rev=1226272774&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-10T00:19:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:translation_of_relations</title>
        <link>https://lara.epfl.ch/w/compilation/translation_of_relations?rev=1226272774&amp;do=diff</link>
        <description>Translation of Relations

Consider translation of &lt;,=,&lt;=,&gt;,&gt;=,=,!= on integers

Operations of type 
int =&gt; int =&gt; {0,1}
But there are no instructions that do this

There are conditional branches for comparison of two stack operands:

	*  in general called</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/tree.scala?rev=1222428100&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:21:40+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:tree.scala</title>
        <link>https://lara.epfl.ch/w/compilation/tree.scala?rev=1222428100&amp;do=diff</link>
        <description>package whilelang;

sealed abstract class Tree

sealed abstract class Statement extends Tree
sealed abstract class SingleStatement extends Statement
case class Print(msg: String, varID: String) extends SingleStatement
case class Assign(varID: String, expr: Expression) extends SingleStatement
/* The Skip statement represents empty statements. Useful for instance in else blocks of if-then-else constructs. */
case object Skip extends SingleStatement
case class Block(body: List[Statement]) extends S…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/treesimplifier.scala?rev=1222428148&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-26T13:22:28+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:treesimplifier.scala</title>
        <link>https://lara.epfl.ch/w/compilation/treesimplifier.scala?rev=1222428148&amp;do=diff</link>
        <description>package whilelang

object TreeSimplifier {
  def apply(stat: Statement): Statement = {
    // replace all for loops by equivalent trees using while loops...
  }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/trivia_bad_languages?rev=1225054328&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-26T21:52:08+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:trivia_bad_languages</title>
        <link>https://lara.epfl.ch/w/compilation/trivia_bad_languages?rev=1225054328&amp;do=diff</link>
        <description>Answer to Python Question


$ python
Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40) 
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; 100*&quot;I will not design bad languages. &quot;
'I will not design bad languages. I will not design bad languages. I will not design bad languages. I will not design bad languages. I will not design bad languages. I will not design bad languages. I will not design bad 
languag…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/type_checking_let_and_letrec?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:type_checking_let_and_letrec</title>
        <link>https://lara.epfl.ch/w/compilation/type_checking_let_and_letrec?rev=1429630495&amp;do=diff</link>
        <description>Type Checking Let and Letrec

Let Expressions

Expression



can be viewed as a shorthand for 



because they both evaluate to 

From this follows the type rule for let expressions:



Example:
We can represent non-recursive method definitions using let</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/type_soundness_for_simply_typed_lambda_calculus?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:type_soundness_for_simply_typed_lambda_calculus</title>
        <link>https://lara.epfl.ch/w/compilation/type_soundness_for_simply_typed_lambda_calculus?rev=1429630495&amp;do=diff</link>
        <description>Type Soundness for Simply Typed Lambda Calculus

We apply the general method in Proving Safety Properties using Types to prove soundness of Simple Types for Lambda Calculus

Basic Notions

We consider the set of types  given by these two rules:

	*  int, bool 
	*  if , then also 

(In particular types cannot have any 'variables' or 'parameters' as in more complex type systems.)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/types_and_programming_languages?rev=1224965800&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-25T22:16:40+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:types_and_programming_languages</title>
        <link>https://lara.epfl.ch/w/compilation/types_and_programming_languages?rev=1224965800&amp;do=diff</link>
        <description>Types and Programming Languages

Types and Programming Languages, by Benjamin C. Pierce

The MIT Press 

Massachusetts Institute of Technology 

Cambridge, Massachusetts 02142 

&lt;http://mitpress.mit.edu&gt; 

ISBN 0-262-16209-1 

	*  &lt;http://www.cis.upenn.edu/~bcpierce/tapl/&gt;</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/types_and_programming_languages_book?rev=1223863491&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-13T04:04:51+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:types_and_programming_languages_book</title>
        <link>https://lara.epfl.ch/w/compilation/types_and_programming_languages_book?rev=1223863491&amp;do=diff</link>
        <description>Types and Programming Languages Book

Types and Programming Languages, by Benjamin C. Pierce

The MIT Press, ISBN 0-262-16209-1 

	*  Author's Page for the Book</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/typestate_analysis?rev=1227696318&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-26T11:45:18+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:typestate_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/typestate_analysis?rev=1227696318&amp;do=diff</link>
        <description>Typestate Analysis

Example

Hypothetical class for reading and writing files:


class File {
  public static final UNINITIALIZED=0;
  public static final OPEN=1;
  public static final CLOSED=2;

  int state = UNINITIALIZED

  [typestate: UNINITIALIZED -&gt; OPEN]
  public void open(name : String) { ... }

  [typestate: OPEN]
  public String readLine() { ... }

  [typestate: OPEN]
  public void writeLine(String line) { ... }

  [typestate: OPEN -&gt; CLOSED]
  void close() { ... }
}</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/typing_rules_for_simple_language?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:typing_rules_for_simple_language</title>
        <link>https://lara.epfl.ch/w/compilation/typing_rules_for_simple_language?rev=1429630495&amp;do=diff</link>
        <description>Type Checking Rules for a Simple Language

Abstract Syntax of a Simple Language

This language is similar to one in Semantic Analysis as Simplified Interpretation, but for simplicity assumes programs have only one class (called World) and all members to are assumed to be static.


program ::= &quot;class&quot; &quot;World&quot; &quot;{&quot; varDecl* method* &quot;}&quot;
method ::= varDecl &quot;(&quot; varDecl* &quot;)&quot; &quot;{&quot; stmt* &quot;return&quot; expr &quot;}&quot;
varDecl ::= type ID
type ::= &quot;int&quot; | &quot;boolean&quot; | &quot;void&quot;
stmt ::= expr | if | while | block 
if ::= &quot;i…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/typos_in_compiler_construction_by_wirth?rev=1226072854&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-07T16:47:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:typos_in_compiler_construction_by_wirth</title>
        <link>https://lara.epfl.ch/w/compilation/typos_in_compiler_construction_by_wirth?rev=1226072854&amp;do=diff</link>
        <description>Typos in Compiler Construction by Wirth

Refers to [This PDF File]

Chapter 10:

	*  page 50, the ADD instruction means R0:=R0+R1</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/using_finite_state_machines_for_lexical_analysis?rev=1222201602&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-23T22:26:42+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:using_finite_state_machines_for_lexical_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/using_finite_state_machines_for_lexical_analysis?rev=1222201602&amp;do=diff</link>
        <description>Using Finite State Machines to Build Lexers

Suppose we have token classes  and each  is given by regular expression .

Consider building an automaton for 

	*  a step towards solution

Example: Construct (directly) a finite state machine for these classes of tokens:</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/variable_capture?rev=1429630495&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2015-04-21T17:34:55+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:variable_capture</title>
        <link>https://lara.epfl.ch/w/compilation/variable_capture?rev=1429630495&amp;do=diff</link>
        <description>Variable Capture

We introduce informally concept of variable capture in Lambda Calculus

The expressions such as  and  denote the same thing, namely a function that differ only by names of bound variables.

	*  we say one expression was obtained by another by -renaming</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/vm_for_expressions?rev=1225624714&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-11-02T12:18:34+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:vm_for_expressions</title>
        <link>https://lara.epfl.ch/w/compilation/vm_for_expressions?rev=1225624714&amp;do=diff</link>
        <description>Stack-Based Virtual Machine for Expression Evaluation

Some instructions:

	*  iadd
			*  imul
			*  iload
			*  istore
			*  bipush


abstract class Instruction 
case class Bipush(c : Int) extends Instruction
case class Iadd extends Instruction
case class Imul extends Instruction
case class Iload(slot : Int) extends Instruction
case class Istore(slot : Int) extends Instruction

class VM(var code    : Array[Instruction],
         var pc      : Int,        // program counter (current instruction)…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/week_02?rev=1221058034&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-10T16:47:14+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:week_02</title>
        <link>https://lara.epfl.ch/w/compilation/week_02?rev=1221058034&amp;do=diff</link>
        <description>Week 02

	*  Lecture 02
	*  Labs 02
	*  Exercises 02</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/what_is_a_compiler?rev=1220862861&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-08T10:34:21+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:what_is_a_compiler</title>
        <link>https://lara.epfl.ch/w/compilation/what_is_a_compiler?rev=1220862861&amp;do=diff</link>
        <description>What is a compiler?

A tool that transforms 
 program in source programming language 
into a
 program in target programming language 
so we can
 run the compiled program on machine 
Typically:

	*  source language is a high-level programming language, such as</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/while_language?rev=1222693420&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-29T15:03:40+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:while_language</title>
        <link>https://lara.epfl.ch/w/compilation/while_language?rev=1222693420&amp;do=diff</link>
        <description>A While Language

While-Language is a little language we use in lectures to illustrate basic concepts.

The exact definition of what is contained in that language will sometimes vary depending on the specific points we want to illustrate, but a possible concrete syntax is given</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/whileparser.scala?rev=1223280304&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-10-06T10:05:04+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:whileparser.scala</title>
        <link>https://lara.epfl.ch/w/compilation/whileparser.scala?rev=1223280304&amp;do=diff</link>
        <description>Recursive Descent Parser for While Language


/* A very simple version of while language:

program ::= statements EOF
statements = statement*
statement ::= print | assign | while | block
write ::= &quot;println&quot; &quot;(&quot; var &quot;)&quot; &quot;;&quot;
assign ::= var &quot;=&quot; expr &quot;;&quot;
while ::= &quot;while&quot; &quot;(&quot; expr &quot;)&quot; statement
block ::= &quot;{&quot; statements &quot;}&quot;
expr ::= expr &quot;+&quot; expr | expr &quot;-&quot; expr | expr &quot;*&quot; expr | 
         &quot;(&quot; expr &quot;)&quot; | var | intconst 
*/

class Parser(lex : Lexer) {
  // program ::= statement* EOF
  def parseProgra…</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/why_study_compilers?rev=1220973123&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-09T17:12:03+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:why_study_compilers</title>
        <link>https://lara.epfl.ch/w/compilation/why_study_compilers?rev=1220973123&amp;do=diff</link>
        <description>Why Study Compilers

Use knowledge to:

	*  understand how compilers work (use them better)
	*  gain experience with building complex software
	*  build compiler for your next great language
	*  extend language with a new construct you need
	*  adapt existing compiler to new target platform (e.g. embedded CPU)</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/why_study_lexical_analysis?rev=1221151310&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-09-11T18:41:50+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:why_study_lexical_analysis</title>
        <link>https://lara.epfl.ch/w/compilation/why_study_lexical_analysis?rev=1221151310&amp;do=diff</link>
        <description>Why Study Lexical Analysis

Context-free grammars are general, why do we study regular expressions first?

“Drunk under the lamppost” effect

Simpler problem, understood better, better automated tools

	*  preparation for parsing</description>
    </item>
    <item rdf:about="https://lara.epfl.ch/w/compilation/xyz_example_using_gcc?rev=1228701133&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-08T02:52:13+0200</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>compilation:xyz_example_using_gcc</title>
        <link>https://lara.epfl.ch/w/compilation/xyz_example_using_gcc?rev=1228701133&amp;do=diff</link>
        <description>xyz Example using GCC


static int x;
static int y;
static int z;
static int res;

int f() {
  res = x * y + y * z + x * z;
}


We compile it for X86 instruction set, using
gcc -S xyz.c
Essential part:


movl    x, %edx
movl    z, %eax
addl    %eax, %edx
movl    y, %eax
movl    %edx, %ecx
imull   %eax, %ecx
movl    x, %edx
movl    z, %eax
imull   %edx, %eax
leal    (%ecx,%eax), %eax   /* load effective address, used as add */
movl    %eax, res</description>
    </item>
</rdf:RDF>
