There are two kinds of errors that Basis can find.

  • Syntax errors occur during the parsing of input code, and are caused by grammatically incorrect statements.
    Typical errors might be an illegal character in the input, a missing operator, two operators in a row,
    two statements on the same line with no intervening semicolon, unbalanced parentheses, a misplaced reserved word, etc.

  •  Semantic errors occur during the execution of the code, after it has been parsed as grammatically correct.
    These have to do not with how statements are constructed, but with what they mean.
    Such things as incorrect variable types or sizes, nonexistent variables, subscripts out of range, and the like, are semantic errors.

Basis is a single-pass  parser, that is, it looks at its input only once.

It also is a one-look ahead  parser, meaning that at the most it is never looking more than one symbol ahead of the current context.

By the time a syntax error has been detected, it is likely that a lot of the context information to the left of the error has already been lost.

The diagnostic information that Basis gives attempts to be as useful as possible,

but because of the very limited context information available, it is far from perfect.

Semantic errors are often possible to diagnose more precisely.

We have attempted to make the semantic error information supplied as useful as possible.

Sometimes some of the information is only useful to someone familiar with the internals of Basis;

but we hope that in most cases it will help you find your error.

Syntax Error:

error due to missing colon, semicolon, parenthesis, etc.

Syntax is the way in which we construct sentences by following principles and rules.

Example: In C++, it would be a syntax error to say

int x = "five";

This will not compile because it does not follow the syntax of the language and does not make any sense to the compiler.

Semantic Error:

it is a logical error. it is due to wrong logical statements.

Semantics is the interpretations of and meanings derived from the sentence transmission and understanding of the message.

Semantics errors are Logical, while Syntax errors are code errors.

Example: A semantic error would compile, but be incorrect logically:

const int pi = 12345;

Your program will likely compile and run without error but your results will be incorrect.

(Note that these types of errors are usually much harder to debug)

Syntactic and Semantic Errors的更多相关文章

  1. Type Systems

    This section deals with more theoretical aspects of types. A type system is a set of rules used by a ...

  2. Understanding Tensorflow using Go

    原文: https://pgaleone.eu/tensorflow/go/2017/05/29/understanding-tensorflow-using-go/ Tensorflow is no ...

  3. 2016年最新mac下vscode配置golang开发环境支持debug

    网上目前还找不到完整的mac下golang环境配置支持,本人配置成功,现在整理分享出来. mac最好装下xcode,好像有依赖关系安装Homebrew打开终端窗口, 粘贴脚本执行/usr/bin/ru ...

  4. coffeescript 1.8.0 documents

    CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque ...

  5. 6.00.1x Introduction to computation

    6.00 Introduction to Computer Science                  and  Programming • Goal: –Become skillful at ...

  6. Word2vec教程

    Word2vec Tutorial RADIM ŘEHŮŘEK 2014-02-02GENSIM, PROGRAMMING157 COMMENTS I never got round to writi ...

  7. coursera课程Text Retrieval and Search Engines之Week 1 Overview

    Week 1 OverviewHelp Center Week 1 On this page: Instructional Activities Time Goals and Objectives K ...

  8. 【DeepLearning】一些资料

    记录下,有空研究. http://nlp.stanford.edu/projects/DeepLearningInNaturalLanguageProcessing.shtml http://nlp. ...

  9. Chapter 4 Syntax Analysis

    Chapter 4 Syntax Analysis This chapter is devoted to parsing methods that are typically used in comp ...

随机推荐

  1. Linux - 磁盘操作

    Linux 磁盘常见操作 : df -Ph # 查看硬盘容量 df -T # 查看磁盘分区格式 df -i # 查看inode节点 如果inode用满后无法创建文件 du -h 目录 # 检测目录下所 ...

  2. CodeForces Contest #1110: Global Round 1

    比赛传送门:CF #1110. 比赛记录:点我. 涨了挺多分,希望下次还能涨. [A]Parity 题意简述: 问 \(k\) 位 \(b\) 进制数 \(\overline{a_1a_2\cdots ...

  3. BurpSuite中的安全测试插件推荐

    Burp Suite 是用于攻击web 应用程序的集成平台.它包含了许多工具,并为这些工具设计了许多接口,以促进加快攻击应用程序的过程.所有的工具都共享一个能处理并显示HTTP 消息,持久性,认证,代 ...

  4. 第一篇:初始Golang

    Golang简介 编程语言已经非常多,偏性能敏感的编译型语言有 C.C++.Java.C#.Delphi和Objective-C 等,偏快速业务开发的动态解析型语言有PHP.Python.Perl.R ...

  5. readb(), readw(), readl(),writeb(), writew(), writel() 宏函数【转】

    转自:http://www.netfoucs.com/article/hustyangju/70429.html readb(), readw(), readl()函数功能:从内存映射的 I/O 空间 ...

  6. casperjs 知乎登陆

    phantom.casperTest = true; phantom.outputEncoding="utf-8"; var fs = require('fs'); var cas ...

  7. Extjs Window用法详解 3 打印具体应用,是否关掉打印预览的界面

    Extjs Window用法详解 3 打印具体应用,是否关掉打印预览的界面   Extjs 中的按钮元素 {xtype: 'buttongroup',title: '打印',items: [me.ts ...

  8. java JVM指令2

    https://www.cnblogs.com/dreamroute/p/5089513.html 指令码 助记符 说明 0x00 nop 什么都不做 0x01 aconst_null 将null推送 ...

  9. Redis五种数据类型-设置key的过期时间

    1.redis命令客户端 [root@localhost bin]# ./redis-cli 127.0.0.1:6379> #是否运行着 127.0.0.1:6379> ping PON ...

  10. C/C++的64位整型

    在C/C++中,64为整型一直是一种没有确定规范的数据类型.现今主流的编译器中,对64为整型的支持也是标准不一,形态各异.一般来说,64位整型的定义方式有long long和__int64两种(VC还 ...