[AI助力] CS143学习笔记1

news2024/12/23 12:14:10

CS143, Compilers Lecture01 Course Overview notes

文章目录

  • CS143, Compilers Lecture01 Course Overview notes
  • AI summary
  • AI notes👇
    • Introduction:
    • Interpreters:
    • Compilers:
    • History:
    • Conclusion:
  • AI flowchart流程图
  • AI flashcards抽认卡
  • AI费曼学习法
  • workflow 总结
  • 关于prompt
  • 相关资源
  • 之后想做的

以下笔记为AI生成+我部分修改,详见workflow

AI summary

  • A lecture by Professor Alex at Stanford University on the topic of compilers and interpreters. The lecture discusses the differences between compilers and interpreters, and their respective advantages and disadvantages. It also provides a brief history of how compilers and interpreters were first developed, starting with the Speedcoding project by John Bacchus in 1953, which was an early example of an interpreter, and leading to the development of FORTRAN, one of the first successful compilers.

AI notes👇

Introduction:

  • Course on compilers and implementation of programming languages presented by Alex Aiken from Stanford University
  • Two major approaches to implementing programming languages: compilers and interpreters
  • Course mainly focuses on compilers but briefly explains interpreters in the first lecture

Interpreters:

  • Takes a program and input data as input and produces output directly without preprocessing the program
  • Interpreter is online and part of running the program
  • Faster to develop programs using an interpreter but interpreted programs are usually slower than compiled or handwritten ones

Compilers:

  • Takes a program as input and produces an executable program as output, which can be run on different inputs to produce output
  • Compiler is offline and preprocesses the program first before producing an executable that can be run multiple times without recompilation

History:

  • Development of machines such as the IBM 704 in the 1950s led to high software costs, resulting in efforts to improve software productivity
  • Speed coding, an early interpreter developed by John Backus, was faster to develop programs but slower than handwritten ones
  • Backus developed Fortran, a successful high-level language with a significant impact on computer science

Conclusion:

  • Programming languages require theory and engineering skills
  • Compilers and interpreters have different advantages and disadvantages
  • Both have played important roles in the development of programming languages.

AI flowchart流程图

下面是chatgpt给我的mermaid代码生成的flowchart!

Welcome to this course on compilers
Two major approaches to implementing programming languages
Compilers
Interpreters
Offline
Produces executable
Online
Produces output directly
History of compilers and interpreters
IBM 704 Machine
Speed Coding
Early Example of Interpreter
Much Faster to Develop
Programs 10-20 times slower
300 bytes of memory
Not popular
John Backus
Formula Translation Project
Translate formula into a form that the machine could execute directly
High-level programming
Allowed for high level programming while still executing machine code
Took three years to complete
Enormous theoretical work
50% of all code by 1958

AI flashcards抽认卡

把整段的字幕放进去加上制卡prompt会出大问题,因为它一次处理不了那么多token,所以下面这段是用的制卡示范的例子加上 概括后的字幕 , 也就是对概括后的笔记进行制卡。

下面这套抽认卡内容上来说有许多地方不太可取,但是形式上让我看到了很多可能性!!!!!

问题答案
这门课程是关于什么的?编译器和编程语言实现。
有哪两种主要的实现编程语言的方法?编译器和解释器。
这门课程主要关注哪种方法?编译器。
第一节课中,Aiken简要解释了什么?解释器。
解释器如何处理程序?将程序和输入数据作为输入,直接产生输出,不需要事先处理程序。
解释器是在线的还是离线的?在线的。
使用解释器开发程序更快还是编译器更快?解释器更快。
解释器处理的程序比编译器产生的程序慢还是快?比编译器产生的程序慢。
编译器如何处理程序?将程序作为输入,产生一个可执行程序作为输出,可以在不重新编译的情况下多次运行该程序。
编译器是在线的还是离线的?离线的。
什么是速度编码?一种早期的解释器,由John Backus开发。
速度编码开发程序更快还是手写更快?开发程序更快。
速度编码处理的程序比手写的程序慢还是快?比手写的程序慢。
什么是Fortran?成功的高级语言,对计算机科学产生了重大影响。
编程语言需要什么?理论和工程技能的良好掌握。
编译器和解释器有什么优缺点?优缺点不同,都在编程语言的发展中发挥了重要作用。

AI费曼学习法

img

What is the difference between an interpreter and a compiler?

  • An interpreter takes the program and data as input, and produces the output directly, without processing the program beforehand. It is an online process. In contrast, a compiler takes the program as input, and produces an executable program as output. This executable can be run on different data sets, without having to recompile or process the program again. Thus, the compiler is an offline process, where the program is pre-processed before execution.

What is an advantage of using an interpreter?

  • Interpreters allow for faster program development, making programmers more productive.

What is a disadvantage of using an interpreter?

  • Programs implemented with an interpreter are typically slower than those written by hand or with a compiler.

What was the Speed Coding project, and who developed it?

  • Speed Coding was a project developed in 1953 by John Backus, which was an early example of an interpreter.

What was the Formula Translation project, and how did it improve upon Speed Coding?

  • The Formula Translation project, also known as FORTRAN, was born out of John Backus’ idea that if formulas were translated into a form that the machine could execute directly, the code would be faster, while still allowing the programmer to write the programs at a high level. Thus, FORTRAN was a compiler that translated programs written in high-level languages into executable programs that could be run on different data sets without having to recompile the program each time. FORTRAN raised the level of abstraction, improved programming productivity, and allowed for better use of computers.

workflow 总结

  • 缺陷:

    • 字幕不准确,比如Fortran 字幕里面搞成了 fortune

    • token限制,可能只概括了一部分

      • 思路可以参考 简悦 AI 的那个网页概括,它是先拆分,再概括整合

        简悦插件 · 基于 OpenAI 的语境理解 AI 系统 - 王磊-Kenshin的文章 - 知乎 https://zhuanlan.zhihu.com/p/606650433

  • slide导入scispace

    • • Compiling is almost this simple, but there are many pitfalls • Example: How to handle erroneous programs? • Language design has big impact on compiler -Determines what is easy and hard to compile -Course theme: many trade-offs in language design
      • Once sentence structure is understood, we can try to understand “meaning” -But meaning is too hard for compilers • IRs are useful because lower levels expose features hidden by higher levels – registers – memory layout– raw pointers etc.
      • But lower levels obscure high-level meaning – Classes– Higher order functions– Even loops… Lexical analysis not trivial

    • 效果不太好,这玩意还是适合读论文

      img

  • slide用edge dev版打开,并提问

  • 谷歌插件:YouTube Summary with ChatGPT

    • 那个点进去直接概括的功能现在好像失效了,但是它那个提取字幕的还是很好用的

      img

  • 文本的长度问题之后需要解决

关于prompt

  • markdown笔记

    img

    "Can you break down the main points or arguments in the text into distinct sections or bullet points? Consider using headings (denoted by `#`) for each section and bullet points (denoted by `-`) for each argument or sub-point. Additionally, are there any key quotes or phrases that you want to highlight or emphasize? You can use bold (denoted by `**`) or italic (denoted by `*`) formatting to make them stand out."
    
  • flashcard参考了叶哥的卡片笔记(知乎)

    • 给ChatGPT施咒,让它为你制作Anki卡片——Prompt工程案例 - 叶峻峣的文章 - 知乎 https://zhuanlan.zhihu.com/p/609413004

    • 上面那个卡片的prompt如下

      按markdown表格形式整理为抽认卡,下面是一个例子:
      文本:
      衰老细胞的特征是细胞内的水分减少,结果使细胞萎缩,体积变小,细胞代谢的速率减慢。细胞内多种酶的活性降低。细胞核的体积增大,核膜内折,染色质收缩、染色加深。细胞膜通透性改变,使物质运输功能降低。
      一套卡片:
      | 问题 | 答案 |
      |---|---|
      |衰老细胞的体积会怎么变化?|变小。|
      |衰老细胞的体积变化的具体表现是什么?|细胞萎缩。|
      |衰老细胞的体积变化原因是什么?|细胞内的水分减少。|
      |衰老细胞内的水分变化对细胞代谢的影响是什么?|细胞代谢的速率减慢。 |
      |衰老细胞内的酶活性如何变化?|活性降低。|
      |衰老细胞的细胞核体积如何变化?|体积变大。|
      |衰老细胞的细胞核的核膜如何变化?|核膜内折。 |
      |衰老细胞的细胞核的染色质如何变化?|染色质收缩。|
      |衰老细胞的细胞核的染色质变化对细胞核形态的影响是?|染色加深。|
      |衰老细胞的物质运输功能如何变化?|物质运输功能降低。|
      |衰老细胞的物质运输功能为何变化?|细胞膜通透性改变。|
      
      下面是你要整理的内容:
      Introduction
      This is a course on compilers and the implementation of programming languages, presented by Alex Aiken, a professor at Stanford University. There are two major approaches to implementing programming languages: compilers and interpreters. This course mainly focuses on compilers, but in the first lecture, Aiken briefly explains interpreters.
      
      Interpreters
      An interpreter takes a program and input data as its input and produces the output directly without processing the program beforehand. The interpreter is online, meaning that it is part of running the program. It is faster to develop programs using an interpreter, but interpreted programs are usually slower than compiled or handwritten ones.
      
      Compilers
      A compiler takes a program as its input and produces an executable program as its output, which can be run on different inputs to produce the output. The compiler is offline, meaning that it preprocesses the program first, then produces an executable that can be run multiple times without recompilation.
      
      History
      The 1950s saw the development of machines such as the IBM 704, which had high hardware costs. As a result, software costs became the dominant expense, leading to efforts to improve software productivity. One such effort was speed coding, an early example of an interpreter developed by John Backus. It was faster to develop programs with speed coding, but they were slower than handwritten ones. Backus developed a new project, the formula translation project or Fortran, which was a successful high-level language with a significant impact on computer science.
      
      Conclusion
      Programming languages require a good grasp of theory and engineering skills. Compilers and interpreters have different advantages and disadvantages, and both have played important roles in the development of programming languages.
      
  • 整理成mermaid流程图:

    • 一开始让它给flowchart代码它听不懂
      • 给了个例子他懂了
    • 直接说mermaid它能懂
    • 其他流程图
      • 油管上看到一个画latex流程图的:ChatGPT Tutorial: From Text to Flowchart in Minutes
    • 下面这个甘特图orz… 是我看的这篇博客里面的https://blog.ouseful.info/2022/12/12/generating-diagrams-from-text-generated-by-chatgpt/
Mon 06 Make soup Serve soup Prepare fish and chips Cook fish and chips Serve fish and chips Soup Fish and Chips Soup and Fish and Chips Meal Plan

相关资源

  • 课程网站

    • CS143: Compilers (stanford.edu)
  • B站 【斯坦福大学】CS143 编译器(完结·中英字幕·机翻·人工校对中)

  • https://csdiy.wiki/%E7%BC%96%E8%AF%91%E5%8E%9F%E7%90%86/CS143/

  • 油管视频

  • 经验贴

    • 编译原理课程推荐 | 斯坦福大学 CS143 : Compilers - 源码被猫吃了的文章 - 知乎 https://zhuanlan.zhihu.com/p/350614886
Compilation
Interpretation
Programming Language Source Code
Machine Code
Output

之后想做的

  • 持续探索更多的学习模态和方法… (powered with artificial intelligence)

  • 如下:

    在这里插入图片描述

    你好,这是Bing。我可以帮你用OpenAI的API来做文本摘要。😊

    根据1和2,你可以使用OpenAI Python库34来调用GPT-3模型,它可以根据文本的内容生成概括的总结,并添加一个“tl;dr:”(太长不看)的标签在最后。

    为了处理很长的文本,你可以先把它分成多个段落,然后对每个段落调用API,最后把所有的总结拼接起来。这样就可以避免token的限制。

    我给你一个Python代码的示例:

    import openai
    openai.api_key = "sk-xxxxxxxxxxxxxxxxxxxxxx" # 你自己的API密钥
    
    # 读取很长的文本文件
    with open("long_text.txt", "r", encoding="utf-8") as f:
        text = f.read()
    
    # 把文本分成多个段落,每个段落不超过2048个字符
    paragraphs = []
    start = 0
    end = 2048
    while start < len(text):
        paragraphs.append(text[start:end])
        start = end
        end += 2048
    
    # 对每个段落调用API,生成总结,并添加tl;dr:标签
    summaries = []
    for paragraph in paragraphs:
        response = openai.Completion.create(
            engine="davinci",
            prompt=paragraph + "\ntl;dr:",
            max_tokens=64,
            temperature=0.3,
            stop=["\n"]
        )
        summary = response["choices"][0]["text"]
        summaries.append(summary)
    
    # 把所有的总结拼接起来,生成markdown格式的输出
    output = ""
    for i, summary in enumerate(summaries):
        output += f"- 段落{i+1}{summary}\n"
    print(output)
    
    

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/386701.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Linux 利用 qemu-system-aarch64 实现 x86 机器安装 arm64 的操作系统

文章目录[toc]遇到的问题安装 qemu-system-aarch64创建 aarch64 操作系统准备 aarch64 的 iso 镜像下载 aarch64 的 UEFI 固件创建虚拟磁盘创建虚拟机语言设置时区设置安装来源软件选择磁盘分区Kdump 配置网络配置root 用户密码创建用户安装操作系统遇到的问题 qemu-system-aar…

问题三十五:傅立叶变换——带通滤波

傅里叶变换&#xff08;Fourier Transform&#xff09;是一种用于分析信号的数学工具&#xff0c;它将信号分解成若干个不同频率的正弦和余弦函数。在图像处理中&#xff0c;傅里叶变换可以用来分析图像中各个频率的成分&#xff0c;从而进行滤波、增强等操作。 在傅里叶变换中…

电商项目后端框架SpringBoot、MybatisPlus

后端框架基础 1.代码自动生成工具 mybatis-plus &#xff08;1&#xff09;首先需要添加依赖文件 <dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.2.2</version></dependency><de…

【markdown】markdown语法

这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题&#xff0c;有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注…

亿华通寻路:“氢”能之火,何以燎原?

氢&#xff0c;是能满足人类一切幻想的终极能源。以氢作为燃料的燃料电池&#xff0c;虽然还没有锂电池行业那样风光&#xff0c;但也在新能源战略布局中占有不可撼动的地位。近两年各界玩家跨界入局&#xff0c;更是掀起了持续的投资浪潮。在国内&#xff0c;政策依然是氢能发…

JAVA进阶--->JVM

文章目录JVM--java Virtual MachineJVM当时学习的存在位置JVM概述(什么是JVM)为什么学习JVM&#xff1f;虚拟机JVM作用JVM组成部分类加器作用类加载过程类什么时候会被加载&#xff08;初始化&#xff09;类加载器双亲委派机制打破双亲委派机制运行时数据区1.程序计数器2.本地方…

提取游戏《Limbus Company》(边狱公司)内素材

注意事项 相关工具会传到网盘。链接如下&#xff08;如果没链接那就是过期还没更新/文章没更新) BGM&#xff1a; 解包工具合集&#xff08;不包含uestdio&#xff0c;assetstdio)&#xff1a;点击此处 此文章主要是讲解如何提取游戏内的音频文件&#xff0c;所以默认各位会…

Spark性能优化四 内存

文章目录&#xff08;一&#xff09;性能优化分析内容怎么被消耗的如何预估程序会消耗多少内存呢(二&#xff09; 性能优化方案1)高性能序列化类库2)持久化或者checkpoint3)JVM 垃圾回收调优4)提高并行度5&#xff09;数据本地化&#xff08;一&#xff09;性能优化分析 一个计…

RocketMQ的基本概念与系统架构

RocketMQ安装与启动基础概念消息&#xff08;Message)主题&#xff08;Topic)标签&#xff08;Tag&#xff09;队列&#xff08;Queue)消息标识&#xff08;MessageId/Key)系统架构生产者 Producer消费者 Consumer名字服务器 NameServer功能介绍路由注册路由剔除路由发现客户端…

【Spark分布式内存计算框架——Structured Streaming】1. Structured Streaming 概述

前言 Apache Spark在2016年的时候启动了Structured Streaming项目&#xff0c;一个基于Spark SQL的全新流计算引擎Structured Streaming&#xff0c;让用户像编写批处理程序一样简单地编写高性能的流处理程序。 Structured Streaming并不是对Spark Streaming的简单改进&#xf…

Hypium框架使能ArkTS应用高效测试

HarmonyOS发布了声明式开发框架ArkUI&#xff0c;带来了极简高效的开发体验&#xff0c;备受广大开发者的青睐。那么&#xff0c;我们在开发过程中&#xff0c;如何确保ArkTS应用的功能和界面满足预期呢&#xff1f;ArkTS应用怎样高效进行专项测试&#xff1f;接下来&#xff0…

机器学习管道中的数据定价

机器学习管道中的数据定价 Data Pricing in Machine Learning 作者&#xff1a;Pipelines Zicun Cong Xuan Luo Pei Jian Feida Zhu Yong Zhang Abstract 机器学习具有破坏性。同时&#xff0c;机器学习只能通过多方协作&#xff0c;在多个步骤中取得成功&#xff0c;就…

Spark 性能调优

1常规性能调优 1.1常规性能调优一&#xff1a;最优资源配置 Spark性能调优的第一步&#xff0c;就是为任务分配更多的资源&#xff0c;在一定范围内&#xff0c;增加资源的分配与性能的提升是成正比的&#xff0c;实现了最优的资源配置后&#xff0c;在此基础上再考虑进行后面…

高研发投入成就产品力,蔚来财报透露重要信号

3月1日晚间&#xff0c;蔚来发布了2022年第四季度及全年财报。 财报显示&#xff0c;蔚来四季度营收160.6亿元&#xff0c;同比增长62.2%&#xff0c;连续11个季度正增长&#xff0c;同时全年总营收达492.7亿元&#xff0c;季度和年度营收均创新高。 尽管过去一年受到新冠疫情…

妇女节到了,祝福所有女神 Happy Women‘s Day!

在每年&#xff13;月&#xff18;日人们庆祝妇女节 &#xff37;omens Day is cllebrated on March 8 every year.国际妇女节(IWD)&#xff0c;中国内地称“三八”国际劳动妇女节或国际劳动妇女节。是在每年的3月8日为庆祝妇女在经济、政治和社会等领域作出的重要贡献和取得的…

5个商用字体网站分享

整理了5个免费、商用字体素材网站&#xff0c;对你有帮助记得点赞收藏。 更多设计素材免费下载&#xff1a; https://www.sucai999.com/?vNTYxMjky 1、FontSpace https://www.fontspace.com/ 这个网站提供了96000款免费字体&#xff0c;可商业用途的字体就有17000款&#xf…

RK3568-IOT核心板不同规格品牌TF卡读写速率测试

1. 测试对象HD-RK3568-IOT 底板基于HD-RK3568-CORE工业级核心板设计&#xff08;双网口、双CAN、 5路串口&#xff09;&#xff0c;接口丰富&#xff0c;适用于工业现场应用需求&#xff0c;亦方便用户评估核心板及CPU的性能。适用于工业自动化控制、人机界面、中小型医疗分析器…

VMworkstation centos虚拟机配置仅主机模式

首先是仅主机模式介绍&#xff0c;可以略过直接看下面具体配置过程。仅主机模式用于在宿主机和虚拟机之间建立局域网&#xff0c;宿主机和虚拟机之间可以互相访问&#xff0c;原理是建立虚拟交换机和宿主机虚拟网卡&#xff08;vmnet1&#xff09;&#xff0c;宿主机虚拟网卡和…

深入分析域内ntlm relay to adcs服务的利用(含wireshark抓包分析)

前言 2021年中旬&#xff0c;specterops发布了一项针对域证书服务(adcs)的利用白皮书&#xff0c;文档中提到了19种对adcs服务的利用。本篇主要是分析文中提出的ntlm relay to adcs窃取证书的攻击流程&#xff0c;原理和抓包分析。 相关内容 ADCS介绍 Active Directory证书…

AI for Science系列(三):赛桨PaddleScience底层核心框架技术创新详解

继上一篇典型案例及API功能介绍&#xff0c;本篇重点讲解飞桨核心框架为支持科学计算任务在技术上的创新工作与成果。 框架技术创新 飞桨科学计算套件赛桨PaddleScience底层技术依赖飞桨核心框架。为了有力地支撑科学计算任务高效训练与推理&#xff0c;飞桨核心框架在自动微…